From c520ca877ae89b27b2ff5cd3ec0d91552ca43628 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Tue, 16 Jun 2009 14:57:09 +0000
Subject: [PATCH] Work on pdd and some other small code refactorings.

---
 AMDiS/libtool                      |   6 +-
 AMDiS/src/AMDiS.h                  |   1 -
 AMDiS/src/DOFAdmin.h               |   2 +-
 AMDiS/src/DOFMatrix.cc             |  18 +-
 AMDiS/src/ParallelDomainProblem.cc | 353 ++++++++++++++++++---------
 AMDiS/src/ParallelDomainProblem.h  |  25 +-
 AMDiS/src/SurfaceOperator.h        |  23 +-
 AMDiS/src/SurfaceQuadrature.cc     |  52 +---
 AMDiS/src/SurfaceQuadrature.h      |  23 +-
 AMDiS/src/SurfaceRegion_ED.h       |  50 ++--
 AMDiS/src/SystemVector.h           | 377 +++++++++++------------------
 AMDiS/src/TecPlotWriter.h          |  23 +-
 AMDiS/src/Tetrahedron.h            |  36 ++-
 AMDiS/src/TimedObject.h            |  63 -----
 AMDiS/src/Traverse.h               |  15 +-
 AMDiS/src/TraverseParallel.h       |   7 +-
 AMDiS/src/Triangle.h               |  86 +++----
 17 files changed, 546 insertions(+), 614 deletions(-)
 delete mode 100644 AMDiS/src/TimedObject.h

diff --git a/AMDiS/libtool b/AMDiS/libtool
index bd275226..332840fb 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -44,7 +44,7 @@ available_tags=" CXX F77"
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host p1d062:
+# Libtool was configured on host p2q004:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 # End:
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
 
-# Libtool was configured on host p1d062:
+# Libtool was configured on host p2q004:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -7065,7 +7065,7 @@ include_expsyms=""
 
 # ### BEGIN LIBTOOL TAG CONFIG: F77
 
-# Libtool was configured on host p1d062:
+# Libtool was configured on host p2q004:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h
index 5d76e3ee..633961e1 100644
--- a/AMDiS/src/AMDiS.h
+++ b/AMDiS/src/AMDiS.h
@@ -84,7 +84,6 @@
 #include "SystemVector.h"
 #include "TecPlotWriter.h"
 #include "Tetrahedron.h"
-#include "TimedObject.h"
 #include "Traverse.h"
 #include "Triangle.h"
 #include "ValueWriter.h"
diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h
index 0e3f2402..da635acd 100644
--- a/AMDiS/src/DOFAdmin.h
+++ b/AMDiS/src/DOFAdmin.h
@@ -213,7 +213,7 @@ namespace AMDiS {
     /// Sets \ref firstHole
     inline void setFirstHole(int i)
     {
-      TEST_EXIT_DBG(!dofFree[i])("There is no hole!\n");
+      TEST_EXIT_DBG(dofFree[i])("There is no hole!\n");
 
       firstHole = i;
     }
diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc
index 08c97866..7fa9f8e6 100644
--- a/AMDiS/src/DOFMatrix.cc
+++ b/AMDiS/src/DOFMatrix.cc
@@ -216,7 +216,8 @@ namespace AMDiS {
 	  applyDBCs.insert(static_cast<int>(row));
 #endif
 	}
-      } else
+      } else {
+
 	for (int j = 0; j < nCol; j++) {  // for all columns
 	  DegreeOfFreedom col = colIndices[j];
 	  double entry = elMat[i][j];
@@ -224,8 +225,9 @@ namespace AMDiS {
 	  if (add)
 	    ins[row][col] += sign * entry;
 	  else
-	    ins[row][col] = sign * entry;
+	    ins[row][col] = sign * entry;	
 	}   
+      }
     }
   }
 
@@ -250,18 +252,6 @@ namespace AMDiS {
 	(*it)->getElementMatrix(elInfo,	elementMatrix, *factorIt ? **factorIt : 1.0);
 
     addElementMatrix(factor, elementMatrix, bound, elInfo, NULL);   
-
-//     if (MPI::COMM_WORLD.Get_rank() == 0 && elInfo->getElement()->getIndex() == 53) {
-//       std::cout << elementMatrix << std::endl;
-
-//       rowFESpace->getBasisFcts()->getLocalIndicesVec(elInfo->getElement(),
-// 						     rowFESpace->getAdmin(),
-// 						     &rowIndices);
-      
-//       rowIndices.print();
-//       print();
-//     }
-
   }
 
   void DOFMatrix::assemble(double factor, ElInfo *elInfo, const BoundaryType *bound,
diff --git a/AMDiS/src/ParallelDomainProblem.cc b/AMDiS/src/ParallelDomainProblem.cc
index 96bd9c81..c3353207 100644
--- a/AMDiS/src/ParallelDomainProblem.cc
+++ b/AMDiS/src/ParallelDomainProblem.cc
@@ -52,13 +52,9 @@ namespace AMDiS {
 
     // Set of all DOFs of the rank.
     std::vector<const DegreeOfFreedom*> rankDOFs;
-    // Set of all interior boundary DOFs in ranks partition which are owned by 
-    // another rank.
-    std::map<const DegreeOfFreedom*, int> boundaryDOFs;
     // Number of DOFs in ranks partition that are owned by the rank.
     int nRankDOFs = 0;
-    // Number of DOFs in ranks partition that are at an interior boundary and are
-    // owned by other ranks.
+    // Number of all DOFs in the macro mesh.
     int nOverallDOFs = 0;
 
     createLocalGlobalNumbering(rankDOFs, boundaryDOFs, nRankDOFs, nOverallDOFs);
@@ -74,7 +70,7 @@ namespace AMDiS {
     removeMacroElements();
       
 
-    /// === Reset all DOFAdmins of the mesh. ===
+    // === Reset all DOFAdmins of the mesh. ===
 
     int nAdmins = mesh->getNumberOfDOFAdmin();
     for (int i = 0; i < nAdmins; i++) {
@@ -85,21 +81,20 @@ namespace AMDiS {
       for (int j = 0; j < static_cast<int>(mapLocalGlobalDOFs.size()); j++)
  	admin.setDOFFree(j, false);
 
-      admin.setUsedSize(mapLocalGlobalDOFs.size() - 1);
+      admin.setUsedSize(mapLocalGlobalDOFs.size());
       admin.setUsedCount(mapLocalGlobalDOFs.size());
       admin.setFirstHole(mapLocalGlobalDOFs.size());
     }
 
+    // === Global refinements. ===
 
-    /// === Global refinements. ===
-
-    refinementManager->globalRefine(mesh, 1);
+//     refinementManager->globalRefine(mesh, 1);
 
-    updateLocalGlobalNumbering(nRankDOFs, nOverallDOFs);
+//     updateLocalGlobalNumbering(nRankDOFs, nOverallDOFs);
 
-    exit(0);
+//     exit(0);
 
-    /// === Create petsc matrix. ===
+    // === Create petsc matrix. ===
 
     int ierr;
     ierr = MatCreate(PETSC_COMM_WORLD, &petscMatrix);
@@ -147,13 +142,14 @@ namespace AMDiS {
     MatAssemblyBegin(petscMatrix, MAT_FINAL_ASSEMBLY);
     MatAssemblyEnd(petscMatrix, MAT_FINAL_ASSEMBLY);
 
+    
     DOFVector<double>::Iterator dofIt(vec, USED_DOFS);
     for (dofIt.reset(); !dofIt.end(); ++dofIt) {
       int index = mapLocalGlobalDOFs[dofIt.getDOFIndex()];
       double value = *dofIt;
 
       VecSetValues(petscRhsVec, 1, &index, &value, ADD_VALUES);
-    }
+    }    
   }
 
 
@@ -185,35 +181,40 @@ namespace AMDiS {
     std::vector<double*> recvBuffers(recvDofs.size());
     
     int i = 0;
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator sendIt = sendDofs.begin();
+    for (std::map<int, std::vector<const DegreeOfFreedom*> >::iterator 
+	   sendIt = sendDofs.begin();
 	 sendIt != sendDofs.end();
 	 ++sendIt, i++) {
-      sendBuffers[i] = new double[sendIt->second.size()];
+      int nSendDOFs = sendIt->second.size();
+      sendBuffers[i] = new double[nSendDOFs];
 
-      for (int j = 0; j < static_cast<int>(sendIt->second.size()); j++)
-	sendBuffers[i][j] = (*vec)[(sendIt->second)[j]];
+      for (int j = 0; j < nSendDOFs; j++)
+	sendBuffers[i][j] = (*vec)[(sendIt->second)[j][0]];
 
-      mpiComm.Isend(sendBuffers[i], sendIt->second.size(), MPI_DOUBLE, sendIt->first, 0);
+      mpiComm.Isend(sendBuffers[i], nSendDOFs, MPI_DOUBLE, sendIt->first, 0);
     }
 
     i = 0;
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvDofs.begin();
+    for (std::map<int, std::vector<const DegreeOfFreedom*> >::iterator 
+	   recvIt = recvDofs.begin();
 	 recvIt != recvDofs.end();
 	 ++recvIt, i++) {
-      recvBuffers[i] = new double[recvIt->second.size()];      
+      int nRecvDOFs = recvIt->second.size();
+      recvBuffers[i] = new double[nRecvDOFs];
 
-      mpiComm.Irecv(recvBuffers[i], recvIt->second.size(), MPI_DOUBLE, recvIt->first, 0);
+      mpiComm.Irecv(recvBuffers[i], nRecvDOFs, MPI_DOUBLE, recvIt->first, 0);
     }
 
     
     mpiComm.Barrier();
     
     i = 0;
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvDofs.begin();
+    for (std::map<int, std::vector<const DegreeOfFreedom*> >::iterator 
+	   recvIt = recvDofs.begin();
 	 recvIt != recvDofs.end();
 	 ++recvIt, i++) {
       for (int j = 0; j < static_cast<int>(recvIt->second.size()); j++)
-	(*vec)[(recvIt->second)[j]] = recvBuffers[i][j];
+	(*vec)[(recvIt->second)[j][0]] = recvBuffers[i][j];
 
       delete [] recvBuffers[i];
     }
@@ -324,7 +325,7 @@ namespace AMDiS {
 	    bool isRankDOF2 = (find(rankDOFs.begin(), rankDOFs.end(), boundDOF2) != rankDOFs.end());
 	    bool ranksBoundary = isRankDOF1 || isRankDOF2;
 
-	    /// === And add the part of the interior boundary. ===
+	    // === And add the part of the interior boundary. ===
 
 	    AtomicBoundary& bound = 
 	      (ranksBoundary ?
@@ -337,7 +338,6 @@ namespace AMDiS {
 	    bound.neighbourObject.el = elInfo->getNeighbour(i);
 	    bound.neighbourObject.subObjAtBoundary = EDGE;
 	    bound.neighbourObject.ithObjAtBoundary = -1;
-	    std::cout << "ADD IN " << mpiRank << ": " << element->getIndex() << " " << elInfo->getNeighbour(i)->getIndex() << std::endl;
  	  }
 	}
       }
@@ -393,7 +393,8 @@ namespace AMDiS {
 	      break;
 
 	  // The element must always be found, because the list is just in another order.
-	  TEST_EXIT(k < rankIt->second.size())("Should never happen!\n");
+	  TEST_EXIT(k < static_cast<int>(rankIt->second.size()))
+	    ("Should never happen!\n");
 
 	  // Swap the current with the found element.
 	  AtomicBoundary tmpBound = (rankIt->second)[k];
@@ -427,12 +428,15 @@ namespace AMDiS {
   }
 
 
-  void ParallelDomainProblemBase::createLocalGlobalNumbering(std::vector<const DegreeOfFreedom*>& rankDOFs,
-							     std::map<const DegreeOfFreedom*, int>& boundaryDOFs,
-							     int& nRankDOFs, 
-							     int& nOverallDOFs)
+  void ParallelDomainProblemBase::createLocalGlobalNumbering(
+                                 std::vector<const DegreeOfFreedom*>& rankDOFs,
+				 std::map<const DegreeOfFreedom*, int>& boundaryDOFs,
+				 int& nRankDOFs, 
+				 int& nOverallDOFs)
   {
-    /// === Get rank information about DOFs. ===
+    FUNCNAME("ParallelDomainProblemBase::createLocalGlobalNumbering()");
+
+    // === Get rank information about DOFs. ===
 
     // Stores to each DOF pointer the set of ranks the DOF is part of.
     std::map<const DegreeOfFreedom*, std::set<int> > partitionDOFs;
@@ -442,17 +446,25 @@ namespace AMDiS {
     nRankDOFs = rankDOFs.size();
     nOverallDOFs = partitionDOFs.size();
 
-    // === Get starting position for global rank dof ordering ====
+
+    // === Get starting position for global rank dof ordering. ====
 
     int rstart = 0;
     MPI_Scan(&nRankDOFs, &rstart, 1, MPI_INT, MPI_SUM, PETSC_COMM_WORLD);
     rstart -= nRankDOFs;
 
    
-    /// === Create information which dof indices must be send and which must be received. ===
+    // === Create information which dof indices must be send and which must  ===
+    // === be received.                                                      ===
+
+    // Stores to each rank a map from DOF pointers (which are all owned by the rank
+    // and lie on an interior boundary) to new global DOF indices.
+    std::map<int, std::map<const DegreeOfFreedom*, DegreeOfFreedom> > sendNewDofs;
 
-    std::map<int, std::map<DegreeOfFreedom, DegreeOfFreedom> > sendNewDofs;
-    std::map<int, std::vector<DegreeOfFreedom> > recvNewDofs;
+    // Maps to each rank the number of new DOF indices this rank will receive from.
+    // All these DOFs are at an interior boundary on this rank, but are owned by
+    // another rank.
+    std::map<int, int> recvNewDofs;
 
     for (std::map<const DegreeOfFreedom*, int>::iterator it = boundaryDOFs.begin();
 	 it != boundaryDOFs.end();
@@ -461,11 +473,9 @@ namespace AMDiS {
       if (it->second == mpiRank) {
 	// If the boundary dof is a rank dof, it must be send to other ranks.
 
-	// old global index
-	int oldDofIndex = (it->first)[0];
 	// search for new dof index in ranks partition for this boundary dof
-	int newDofIndex = 0;
-	for (int i = 0; i < static_cast<int>(rankDOFs.size()); i++) {
+	DegreeOfFreedom newDofIndex = 0;
+	for (int i = 0; i < nRankDOFs; i++) {
 	  if (rankDOFs[i] == it->first) {
 	    newDofIndex = rstart + i;
 	    break;
@@ -477,64 +487,79 @@ namespace AMDiS {
 	     itRanks != partitionDOFs[it->first].end();
 	     ++itRanks) {
 	  if (*itRanks != mpiRank)
-	    sendNewDofs[*itRanks][oldDofIndex] = newDofIndex;
+	    sendNewDofs[*itRanks][it->first] = newDofIndex;
 	}
       } else {
 	// If the boundary dof is not a rank dof, its new dof index, and later
 	// also the dof values, must be received from another rank.
-	recvNewDofs[it->second].push_back((it->first)[0]);
+	if (recvNewDofs.find(it->second) == recvNewDofs.end()) 
+	  recvNewDofs[it->second] = 1;
+	else
+	  recvNewDofs[it->second]++;
       }
     }
 
 
-    /// === Send and receive the dof indices at boundary. ===
+    // === Send and receive the dof indices at boundary. ===
 
     std::vector<int*> sendBuffers(sendNewDofs.size());
     std::vector<int*> recvBuffers(recvNewDofs.size());
+
+    sendDofs.clear();
+    recvDofs.clear();
     
     int i = 0;
-    for (std::map<int, std::map<DegreeOfFreedom, DegreeOfFreedom> >::iterator sendIt = sendNewDofs.begin();
+    for (std::map<int, std::map<const DegreeOfFreedom*, DegreeOfFreedom> >::iterator 
+	   sendIt = sendNewDofs.begin();
 	 sendIt != sendNewDofs.end();
 	 ++sendIt, i++) {
-      sendBuffers[i] = new int[sendIt->second.size() * 2];
+      int nSendDOFs = sendIt->second.size() * 2;
+      sendBuffers[i] = new int[nSendDOFs];
       int c = 0;
-      for (std::map<DegreeOfFreedom, DegreeOfFreedom>::iterator dofIt = sendIt->second.begin();
+      for (std::map<const DegreeOfFreedom*, DegreeOfFreedom>::iterator 
+	     dofIt = sendIt->second.begin();
 	   dofIt != sendIt->second.end();
-	   ++dofIt, c += 2) {
-	sendBuffers[i][c] = dofIt->first;
-	sendBuffers[i][c + 1] = dofIt->second;
+	   ++dofIt) {
+	sendBuffers[i][c++] = (dofIt->first)[0];
+	sendBuffers[i][c++] = dofIt->second;
 
-	sendDofs[sendIt->first].push_back(dofIt->second);
+	sendDofs[sendIt->first].push_back(dofIt->first);
       }
 
-      mpiComm.Isend(sendBuffers[i], sendIt->second.size() * 2, MPI_INT, sendIt->first, 0);
+      mpiComm.Isend(sendBuffers[i], nSendDOFs, MPI_INT, sendIt->first, 0);
     }
 
     i = 0;
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvNewDofs.begin();
+    for (std::map<int, int>::iterator recvIt = recvNewDofs.begin();
 	 recvIt != recvNewDofs.end();
 	 ++recvIt, i++) {
-      recvBuffers[i] = new int[recvIt->second.size() * 2];
+      int nRecvDOFs = recvIt->second * 2;
+      recvBuffers[i] = new int[nRecvDOFs];
 
-      mpiComm.Irecv(recvBuffers[i], recvIt->second.size() * 2, MPI_INT, recvIt->first, 0);
+      mpiComm.Irecv(recvBuffers[i], nRecvDOFs, MPI_INT, recvIt->first, 0);
     }
 
 
     mpiComm.Barrier();
 
     
-    /// === Delete send buffers. ===
+    // === Delete send buffers. ===
 
     i = 0;
-    for (std::map<int, std::map<DegreeOfFreedom, DegreeOfFreedom> >::iterator sendIt = sendNewDofs.begin();
+    for (std::map<int, std::map<const DegreeOfFreedom*, DegreeOfFreedom> >::iterator 
+	   sendIt = sendNewDofs.begin();
 	 sendIt != sendNewDofs.end();
 	 ++sendIt, i++) 
       delete [] sendBuffers[i];
 
 
-    /// === Change dof indices for rank partition. ===
+    // === Change dof indices for rank partition. ===
+
+    mapLocalGlobalDOFs.clear();
+    mapGlobalLocalDOFs.clear();
+    isRankDOF.clear();
 
-    for (int i = 0; i < static_cast<int>(rankDOFs.size()); i++) {
+    for (int i = 0; i < nRankDOFs; i++) {
       const_cast<DegreeOfFreedom*>(rankDOFs[i])[0] = i; 
       mapLocalGlobalDOFs[i] = rstart + i;
       mapGlobalLocalDOFs[rstart + i] = i;
@@ -542,55 +567,67 @@ namespace AMDiS {
     }
 
 
-    /// === Change dof indices at boundary from other ranks. ===
+    // === Change dof indices at boundary from other ranks. ===
 
     i = 0;
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvNewDofs.begin();
+    for (std::map<int, int>::iterator recvIt = recvNewDofs.begin();
 	 recvIt != recvNewDofs.end();
 	 ++recvIt, i++) {
 
-      for (int j = 0; j < static_cast<int>(recvIt->second.size()); j++) {
+      for (int j = 0; j < recvIt->second; j++) {
 
-	int oldDof = recvBuffers[i][j * 2];
-	int newDof = recvBuffers[i][j * 2 + 1];
-	int newLocalDof = mapLocalGlobalDOFs.size();
+	DegreeOfFreedom oldDof = recvBuffers[i][j * 2];
+	DegreeOfFreedom newGlobalDof = recvBuffers[i][j * 2 + 1];
+	DegreeOfFreedom newLocalDof = mapLocalGlobalDOFs.size();
 
-	recvDofs[recvIt->first].push_back(newDof);
+	bool found = false;
 
 	for (std::map<const DegreeOfFreedom*, int>::iterator dofIt = boundaryDOFs.begin();
 	     dofIt != boundaryDOFs.end();
 	     ++dofIt) {
+
 	  if ((dofIt->first)[0] == oldDof) {
+	    recvDofs[recvIt->first].push_back(dofIt->first);
 	    const_cast<DegreeOfFreedom*>(dofIt->first)[0] = newLocalDof;
-	    mapLocalGlobalDOFs[newLocalDof] = newDof;
-	    mapGlobalLocalDOFs[newDof] = newLocalDof;
+	    mapLocalGlobalDOFs[newLocalDof] = newGlobalDof;
+	    mapGlobalLocalDOFs[newGlobalDof] = newLocalDof;
 	    isRankDOF[newLocalDof] = false;
+	    found = true;
 	    break;
 	  }
 	}
+
+	TEST_EXIT(found)("Should not happen!\n");
       }
 
       delete [] recvBuffers[i];
     }
 
+#if 1
+    // === Create local information from sendDofs and recvDofs
 
-    /// === Create local information from sendDofs and recvDofs
-
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator it = sendDofs.begin();
+    for (std::map<int, std::vector<const DegreeOfFreedom*> >::iterator 
+	   it = sendDofs.begin();
 	 it != sendDofs.end();
 	 ++it)
-      for (std::vector<DegreeOfFreedom>::iterator dofIt = it->second.begin();
+      for (std::vector<const DegreeOfFreedom*>::iterator dofIt = it->second.begin();
 	   dofIt != it->second.end();
-	   dofIt++)
-	*dofIt = mapGlobalLocalDOFs[*dofIt];
+	   dofIt++) {
+	//	std::cout << "AND SET S " << (*dofIt)[0] << " = " << mapGlobalLocalDOFs[(*dofIt)[0]] << std::endl;
+	//	const_cast<DegreeOfFreedom*>(*dofIt)[0] = mapGlobalLocalDOFs[(*dofIt)[0]];
+      }
 
-    for (std::map<int, std::vector<DegreeOfFreedom> >::iterator it = recvDofs.begin();
+    for (std::map<int, std::vector<const DegreeOfFreedom*> >::iterator 
+	   it = recvDofs.begin();
 	 it != recvDofs.end();
 	 ++it)
-      for (std::vector<DegreeOfFreedom>::iterator dofIt = it->second.begin();
+      for (std::vector<const DegreeOfFreedom*>::iterator dofIt = it->second.begin();
 	   dofIt != it->second.end();
-	   dofIt++)
-	*dofIt = mapGlobalLocalDOFs[*dofIt];  
+	   dofIt++) {
+	//	std::cout << "AND SET R " << (*dofIt)[0] << " = " << mapGlobalLocalDOFs[(*dofIt)[0]] << std::endl;
+	//	const_cast<DegreeOfFreedom*>(*dofIt)[0] = mapGlobalLocalDOFs[(*dofIt)[0]];
+      }
+#endif
   }
 
 
@@ -600,10 +637,9 @@ namespace AMDiS {
     FUNCNAME("ParallelDomainProblemBase::updateLocalGlobalNumbering()");
 
     std::set<const DegreeOfFreedom*> rankDOFs;
-    std::map<const DegreeOfFreedom*, int> boundaryDOFs;
-
+    std::map<const DegreeOfFreedom*, int> newBoundaryDOFs;
     
-    /// === Get all DOFs in ranks partition. ===
+    // === Get all DOFs in ranks partition. ===
 
     TraverseStack stack;
     ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
@@ -620,6 +656,9 @@ namespace AMDiS {
     // === Traverse on interior boundaries and move all not ranked owned DOFs from ===
     // === rankDOFs to boundaryDOFs                                                ===
 
+    std::map<int, std::vector<const DegreeOfFreedom*> > sendNewDOFs;
+    std::map<int, std::vector<const DegreeOfFreedom*> > recvNewDOFs;
+
     for (std::map<int, std::vector<AtomicBoundary> >::iterator it = 
 	   myIntBoundary.boundary.begin();
 	 it != myIntBoundary.boundary.end();
@@ -647,72 +686,147 @@ namespace AMDiS {
 	  ERROR_EXIT("Should never happen!\n");
 	}
 
+	TEST_EXIT(boundaryDOFs.find(dof1) != boundaryDOFs.end())
+	  ("Should never happen!\n");
+	TEST_EXIT(boundaryDOFs.find(dof2) != boundaryDOFs.end())
+	  ("Should never happen!\n");
+
+	newBoundaryDOFs[dof1] = boundaryDOFs[dof1];
+	newBoundaryDOFs[dof2] = boundaryDOFs[dof2];
+
 	std::vector<const DegreeOfFreedom*> boundDOFs;
 	addAllDOFs(boundIt->rankObject.el, boundIt->rankObject.ithObjAtBoundary,
 		   boundDOFs);
+	for (int i = 0; i < static_cast<int>(boundDOFs.size()); i++) {
+	  newBoundaryDOFs[boundDOFs[i]] = mpiRank;
+	  sendNewDOFs[it->first].push_back(boundDOFs[i]);
+	}
       }
     }    
-  }
 
 
-  void ParallelDomainProblemBase::addAllDOFs(Element *el, int ithEdge, 
-					     std::vector<const DegreeOfFreedom*>& dofs,
-					     bool addVertices)
-  {
-    FUNCNAME("ParallelDomainProblemBase::addAllDOFs()");
+    for (std::map<int, std::vector<AtomicBoundary> >::iterator it = 
+	   otherIntBoundary.boundary.begin();
+	 it != otherIntBoundary.boundary.end();
+	 ++it) {
+      for (std::vector<AtomicBoundary>::iterator boundIt = it->second.begin();
+	   boundIt != it->second.end();
+	   ++boundIt) {
+	const DegreeOfFreedom *dof1 = NULL;
+	const DegreeOfFreedom *dof2 = NULL;
+
+	switch (boundIt->rankObject.ithObjAtBoundary) {
+	case 0:
+	  dof1 = boundIt->rankObject.el->getDOF(1);
+	  dof2 = boundIt->rankObject.el->getDOF(2);
+	  break;
+	case 1:
+	  dof1 = boundIt->rankObject.el->getDOF(0);
+	  dof2 = boundIt->rankObject.el->getDOF(2);
+	  break;
+	case 2:
+	  dof1 = boundIt->rankObject.el->getDOF(0);
+	  dof2 = boundIt->rankObject.el->getDOF(1);
+	  break;
+	default:
+	  ERROR_EXIT("Should never happen!\n");
+	}
+
+	TEST_EXIT(boundaryDOFs.find(dof1) != boundaryDOFs.end())
+	  ("Should never happen!\n");
+	TEST_EXIT(boundaryDOFs.find(dof2) != boundaryDOFs.end())
+	  ("Should never happen!\n");
+
+	rankDOFs.erase(dof1);
+	rankDOFs.erase(dof2);
+	newBoundaryDOFs[dof1] = boundaryDOFs[dof1];
+	newBoundaryDOFs[dof2] = boundaryDOFs[dof2];
 
-    const DegreeOfFreedom* boundDOF1 = NULL;
-    const DegreeOfFreedom* boundDOF2 = NULL;
-
-    if (addVertices) {
-      switch (ithEdge) {
-      case 0:
-	boundDOF1 = el->getDOF(1);
-	boundDOF2 = el->getDOF(2);
-	break;
-      case 1:
-	boundDOF1 = el->getDOF(0);
-	boundDOF2 = el->getDOF(2);
-	break;
-      case 2:
-	boundDOF1 = el->getDOF(0);
-	boundDOF2 = el->getDOF(1);
-	break;
-      default:
-	ERROR_EXIT("Should never happen!\n");
+	std::vector<const DegreeOfFreedom*> boundDOFs;
+	addAllDOFs(boundIt->rankObject.el, boundIt->rankObject.ithObjAtBoundary,
+		   boundDOFs);
+	for (int i = 0; i < static_cast<int>(boundDOFs.size()); i++) {
+	  rankDOFs.erase(boundDOFs[i]);
+	  newBoundaryDOFs[boundDOFs[i]] = it->first;
+	  recvNewDOFs[it->first].push_back(boundDOFs[i]);
+	}
       }
 
-      dofs.push_back(boundDOF1);
     }
 
+    nRankDOFs = rankDOFs.size();
+
+    // === Get starting position for global rank dof ordering. ====
+
+    int rstart = 0;
+    MPI_Scan(&nRankDOFs, &rstart, 1, MPI_INT, MPI_SUM, PETSC_COMM_WORLD);
+    rstart -= nRankDOFs;
+
+
+    // === Calculate number of overall DOFs of all partitions. ===
+
+    MPI_Allreduce(&nRankDOFs, &nOverallDOFs, 1, MPI_INT, MPI_SUM, PETSC_COMM_WORLD);
+
+
+    // === Create new local DOF index numbering. ===
+
+    mapLocalGlobalDOFs.clear();
+    mapGlobalLocalDOFs.clear();
+    isRankDOF.clear();
+
+    int i = 0;
+    for (std::set<const DegreeOfFreedom*>::iterator dofIt = rankDOFs.begin();
+	 dofIt != rankDOFs.end();
+	 ++dofIt, i++) {
+      const_cast<DegreeOfFreedom*>(*dofIt)[0] = i;
+      mapLocalGlobalDOFs[i] = rstart + i;
+      mapGlobalLocalDOFs[rstart + i] = i;
+      isRankDOF[i] = true;
+    }
+
+
+    // === Send new DOF indices. ===
+
+    for (int rank = 0; rank < mpiSize; rank++) {
+      if (rank == mpiRank) 
+	continue;
+
+      
+    }
+
+  }
+
+
+  void ParallelDomainProblemBase::addAllDOFs(Element *el, int ithEdge, 
+					     std::vector<const DegreeOfFreedom*>& dofs)
+  {
+    FUNCNAME("ParallelDomainProblemBase::addAllDOFs()");
+
     switch (ithEdge) {
     case 0:
       if (el->getSecondChild() && el->getSecondChild()->getFirstChild()) {
-	addAllDOFs(el->getSecondChild()->getFirstChild(), 0, dofs, false);
+	addAllDOFs(el->getSecondChild()->getFirstChild(), 0, dofs);
 	dofs.push_back(el->getSecondChild()->getFirstChild()->getDOF(2));
-	addAllDOFs(el->getSecondChild()->getSecondChild(), 1, dofs, false);
+	addAllDOFs(el->getSecondChild()->getSecondChild(), 1, dofs);
       }
       break;
     case 1:
       if (el->getFirstChild() && el->getFirstChild()->getFirstChild()) {
-	addAllDOFs(el->getFirstChild()->getFirstChild(), 0, dofs, false);
+	addAllDOFs(el->getFirstChild()->getFirstChild(), 0, dofs);
 	dofs.push_back(el->getFirstChild()->getFirstChild()->getDOF(2));
-	addAllDOFs(el->getFirstChild()->getSecondChild(), 1, dofs, false);
+	addAllDOFs(el->getFirstChild()->getSecondChild(), 1, dofs);
       }
       break;
     case 2:      
       if (el->getFirstChild()) {
-	addAllDOFs(el->getFirstChild(), 0, dofs, false);
+	addAllDOFs(el->getFirstChild(), 0, dofs);
 	dofs.push_back(el->getFirstChild()->getDOF(2));
-	addAllDOFs(el->getSecondChild(), 1, dofs, false);
+	addAllDOFs(el->getSecondChild(), 1, dofs);
       }
       break;      
     default:
       ERROR_EXIT("Should never happen!\n");
     }
-
-    if (addVertices)
-      dofs.push_back(boundDOF2);		   
   }
 
 
@@ -721,7 +835,7 @@ namespace AMDiS {
 		       std::vector<const DegreeOfFreedom*>& rankDOFs,
 		       std::map<const DegreeOfFreedom*, int>& boundaryDOFs)
   {
-    /// === Determine to each dof the set of partitions the dof belongs to. ===
+    // === Determine to each dof the set of partitions the dof belongs to. ===
 
     TraverseStack stack;
     ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
@@ -735,14 +849,18 @@ namespace AMDiS {
       elInfo = stack.traverseNext(elInfo);
     }
 
-    /// === Determine the set of ranks dofs and the dofs ownership at the boundary. ===
+    // === Determine the set of ranks dofs and the dofs ownership at the boundary. ===
 
+    // iterate over all DOFs
     for (std::map<const DegreeOfFreedom*, std::set<int> >::iterator it = partitionDOFs.begin();
 	 it != partitionDOFs.end();
 	 ++it) {
+
+      // iterate over all partition the current DOF is part of.
       for (std::set<int>::iterator itpart1 = it->second.begin();
 	   itpart1 != it->second.end();
 	   ++itpart1) {
+
 	if (*itpart1 == mpiRank) {
 	  if (it->second.size() == 1) {
 	    rankDOFs.push_back(it->first);
@@ -770,6 +888,7 @@ namespace AMDiS {
 
 	  break;
 	}
+
       }
     }
   }
diff --git a/AMDiS/src/ParallelDomainProblem.h b/AMDiS/src/ParallelDomainProblem.h
index 5fec46ac..3be72446 100644
--- a/AMDiS/src/ParallelDomainProblem.h
+++ b/AMDiS/src/ParallelDomainProblem.h
@@ -130,6 +130,18 @@ namespace AMDiS {
     /// Removes all macro elements from the mesh that are not part of ranks partition.
     void removeMacroElements();
 
+
+    /** \brief
+     * Creates from a macro mesh a correct local and global DOF index numbering.
+     *
+     * @param[out] rankDOFs      Returns all DOFs from the macro mesh, which are owned
+     *                           by the rank after partitioning the macro mesh.
+     * @param[out] boundaryDOFs  Returns all DOFs from the macro mesh, which lies at
+     *                           an interior boundary of the rank. This object maps
+     *                           each such DOF to the rank that owns this DOF.
+     * @param[out] nRankDOFs     Number of DOFs owned by rank.
+     * @param[out] nOverallDOFs  Number of all DOFs in macro mesh.
+     */
     void createLocalGlobalNumbering(std::vector<const DegreeOfFreedom*>& rankDOFs,
 				    std::map<const DegreeOfFreedom*, int>& boundaryDOFs,
 				    int& nRankDOFs, 
@@ -138,8 +150,7 @@ namespace AMDiS {
     void updateLocalGlobalNumbering(int& nRankDOFs, int& nOverallDOFs);
 
     void addAllDOFs(Element *el, int ithEdge, 
-		    std::vector<const DegreeOfFreedom*>& dofs,
-		    bool addVertices = true);
+		    std::vector<const DegreeOfFreedom*>& dofs);
 
     /** \brief
      * This function traverses the whole mesh, i.e. before it is really partitioned,
@@ -220,6 +231,12 @@ namespace AMDiS {
     /// Number of DOFs in the rank mesh.
     int nRankDOFs;
 
+    /** \brief
+     * Set of all interior boundary DOFs in ranks partition. The object maps to
+     * each such DOF to the number of the rank that owns this DOF.
+     */
+    std::map<const DegreeOfFreedom*, int> boundaryDOFs;
+
     /** \brief 
      * Defines the interior boundaries of the domain that result from partitioning
      * the whole mesh. Contains only the boundaries, which are owned by the rank, i.e.,
@@ -240,13 +257,13 @@ namespace AMDiS {
      * This map contains for each rank the list of dofs the current rank must send
      * to exchange solution dofs at the interior boundaries.
      */
-    std::map<int, std::vector<DegreeOfFreedom> > sendDofs;
+    std::map<int, std::vector<const DegreeOfFreedom*> > sendDofs;
 
     /** \brief
      * This map contains for each rank the list of dofs from which the current rank 
      * must receive solution values of dofs at the interior boundaries.
      */
-    std::map<int, std::vector<DegreeOfFreedom> > recvDofs;
+    std::map<int, std::vector<const DegreeOfFreedom*> > recvDofs;
 
     /// Maps local to global dof indices.
     std::map<DegreeOfFreedom, DegreeOfFreedom> mapLocalGlobalDOFs;
diff --git a/AMDiS/src/SurfaceOperator.h b/AMDiS/src/SurfaceOperator.h
index 54194cd6..ea28bb91 100644
--- a/AMDiS/src/SurfaceOperator.h
+++ b/AMDiS/src/SurfaceOperator.h
@@ -100,21 +100,14 @@ namespace AMDiS {
     {
       coords_ = coords;
 
-      if (quad2) {
+      if (quad2)
 	quad2->scaleSurfaceQuadrature(coords);
-      }
-
-      if (quad1GrdPsi) {
+      if (quad1GrdPsi)
 	quad1GrdPsi->scaleSurfaceQuadrature(coords);
-      }
-
-      if (quad1GrdPhi) {
+      if (quad1GrdPhi)
 	quad1GrdPhi->scaleSurfaceQuadrature(coords);
-      }
-
-      if (quad0) {
+      if (quad0)
 	quad0->scaleSurfaceQuadrature(coords);
-      }
     }
 
     /** \brief
@@ -126,16 +119,14 @@ namespace AMDiS {
 				  ElementMatrix& userMat, 
 				  double factor = 1.0)
     {
-      int i;
       int dim = rowFESpace->getMesh()->getDim();
       double origDet = elInfo->getDet();
 
       FixVec<WorldVector<double>, VERTEX> worldCoords(dim-1, NO_INIT);
 
       // transform barycentric coords to world coords
-      for(i = 0; i < dim; i++) {
+      for (int i = 0; i < dim; i++)
 	elInfo->coordToWorld(coords_[i], worldCoords[i]);
-      }
 
       // set determinant for world coords of the side
       const_cast<ElInfo*>(elInfo)->setDet(elInfo->calcDet(worldCoords));
@@ -177,9 +168,7 @@ namespace AMDiS {
   protected:
     VectorOfFixVecs<DimVec<double> > coords_;
 
-    /** \brief
-     * Surface quadratures
-     */
+    /// Surface quadratures
     SurfaceQuadrature *quad2;
     SurfaceQuadrature *quad1GrdPsi;
     SurfaceQuadrature *quad1GrdPhi;
diff --git a/AMDiS/src/SurfaceQuadrature.cc b/AMDiS/src/SurfaceQuadrature.cc
index 06d418c3..a52ca1dd 100644
--- a/AMDiS/src/SurfaceQuadrature.cc
+++ b/AMDiS/src/SurfaceQuadrature.cc
@@ -5,8 +5,6 @@
 
 namespace AMDiS {
 
-  //std::list<SurfaceQuadrature*> SurfaceQuadrature::surfaceQuadratureList;
-
   SurfaceQuadrature::SurfaceQuadrature(Quadrature *quad,
 				       VectorOfFixVecs<DimVec<double> > &coords)
     : Quadrature((quad->getName() + " surface").c_str(),
@@ -18,69 +16,39 @@ namespace AMDiS {
       quad_(quad),
       coords_(coords)
   {
-    int i, j, k;
-
-    // copy coords
-    // coords_ = new DimVec<double>[dim](dim, NO_INIT);
-    //   for(i = 0; i < dim; i++) {
-    //     coords_[i] = coords[i];
-    //   }
-  
     lambda = new VectorOfFixVecs<DimVec<double> >(dim, n_points, NO_INIT);
 
     // for each integration point
-    for(i=0; i < n_points; i++) {
+    for (int i = 0; i < n_points; i++) {
       // get coords of quadrature point in dim-1
       DimVec<double> origin = quad->getLambda(i);
 
-      for(j=0; j < dim+1; j++)
+      for (int j = 0; j < dim + 1; j++)
 	(*lambda)[i][j] = 0.0;
 
-      for(j = 0; j < dim; j++) {
-	for(k = 0; k < dim+1; k++) {
+      for (int j = 0; j < dim; j++)
+	for (int k = 0; k < dim + 1; k++)
 	  (*lambda)[i][k] += origin[j] * coords_[j][k];
-	}
-      }
-    
-      //     // create barycentric coords for dim
-      //     if(dim > 1) {
-      //       for (j = 0; j < side; j++)
-      // 	(*lambda)[i][j] = origin[j];
-
-      //       (*lambda)[i][side] = 0.0;
-      
-      //       for (j = side+1; j <= dim; j++)
-      // 	(*lambda)[i][j] = origin[j-1];
-      //     } else {
-      //       (*lambda)[i][side] = 1.0;
-      //       (*lambda)[i][1-side] = 0.0;
-      //     }
     }
   }
 
-  void
-  SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
+  void SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
   {
-    int i, j, k;
-
     // copy coords
-    for(i = 0; i < dim; i++) {
+    for (int i = 0; i < dim; i++)
       coords_[i] = coords[i];
-    }
   
     // for each integration point
-    for(i=0; i < n_points; i++) {
+    for (int i = 0; i < n_points; i++) {
       // get coords of quadrature point in dim-1
       DimVec<double> origin = quad_->getLambda(i);
 
-      for(j=0; j < dim+1; j++)
+      for (int j = 0; j < dim + 1; j++)
 	(*lambda)[i][j] = 0.0;
 
-      for(j = 0; j < dim; j++) {
-	for(k = 0; k < dim+1; k++) {
+      for (int j = 0; j < dim; j++)
+	for (int k = 0; k < dim+1; k++)
 	  (*lambda)[i][k] += origin[j] * coords_[j][k];
-	}
-      }
     }
   }
 
diff --git a/AMDiS/src/SurfaceQuadrature.h b/AMDiS/src/SurfaceQuadrature.h
index 81fa9573..004c7bad 100644
--- a/AMDiS/src/SurfaceQuadrature.h
+++ b/AMDiS/src/SurfaceQuadrature.h
@@ -39,36 +39,21 @@ namespace AMDiS {
   class SurfaceQuadrature : public Quadrature
   {
   public:
-    /** \brief
-     * Constructs a SurfaceQuadrature based on a standard Quadrature of dim-1.
-     */
+    /// Constructs a SurfaceQuadrature based on a standard Quadrature of dim-1.
     SurfaceQuadrature(Quadrature *quad, VectorOfFixVecs<DimVec<double> >& coords);
 
-    /** \brief
-     * Destructor.
-     */
+    /// Destructor.
     ~SurfaceQuadrature()
     {}
 
-    /** \brief
-     * Adapts SurfaceQuadrature to \ref coords.
-     */
+    /// Adapts SurfaceQuadrature to \ref coords.
     void scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> > &coords);
 
   protected:
-    /** \brief
-     * Pointer to the original quadrature
-     */
+    /// Pointer to the original quadrature
     Quadrature *quad_;
 
     VectorOfFixVecs<DimVec<double> > coords_;
-
-    /** \brief
-     * List of all existing surface quadratures. Used by 
-     * \ref provideSurfaceQuadrature(). If the needed quadrature is not in the
-     * list, a new list entry is created.
-     */
-    //static std::list<SurfaceQuadrature*> surfaceQuadratureList;
   };
 
 }
diff --git a/AMDiS/src/SurfaceRegion_ED.h b/AMDiS/src/SurfaceRegion_ED.h
index 76b40b88..4ddb4650 100644
--- a/AMDiS/src/SurfaceRegion_ED.h
+++ b/AMDiS/src/SurfaceRegion_ED.h
@@ -31,7 +31,7 @@ namespace AMDiS {
   {
   public:
     inline bool isOfType(int typeID) const {
-      if(typeID == SURFACE_REGION) 
+      if (typeID == SURFACE_REGION) 
 	return true;
       return false;
     }
@@ -39,7 +39,8 @@ namespace AMDiS {
     class Creator : public CreatorInterface<ElementData>
     {
     public:
-      ElementData* create() {
+      ElementData* create() 
+      {
 	return new SurfaceRegion_ED;
       }
     };
@@ -61,7 +62,7 @@ namespace AMDiS {
       SurfaceRegion_ED *surfaceRegion;
 
       sideOfChild = parent->getSideOfChild(0, side_, elType);
-      if(sideOfChild >= 0) {
+      if (sideOfChild >= 0) {
 	surfaceRegion = new SurfaceRegion_ED(child1->getElementData());
 	surfaceRegion->setSide(sideOfChild);
 	surfaceRegion->setRegion(region_);
@@ -69,7 +70,7 @@ namespace AMDiS {
       }    
 
       sideOfChild = parent->getSideOfChild(1, side_, elType);
-      if(sideOfChild >= 0) {
+      if (sideOfChild >= 0) {
 	surfaceRegion = new SurfaceRegion_ED(child2->getElementData());
 	surfaceRegion->side_ = sideOfChild;
 	surfaceRegion->region_ = region_;
@@ -77,41 +78,60 @@ namespace AMDiS {
       }
 
       return false;
-    };
+    }
 
-    ElementData *clone() const { 
+    ElementData *clone() const 
+    { 
       SurfaceRegion_ED *newObj = new SurfaceRegion_ED;
       newObj->side_ = side_;
       newObj->region_ = region_;
       newObj->decorated_ = ElementData::clone();
       return newObj; 
-    };
+    }
 
-    inline std::string getTypeName() const { return "SurfaceRegion_ED"; };
+    inline std::string getTypeName() const 
+    { 
+      return "SurfaceRegion_ED"; 
+    }
 
-    inline const int getTypeID() const { return SURFACE_REGION; };
+    inline const int getTypeID() const 
+    { 
+      return SURFACE_REGION; 
+    }
 
     void serialize(std::ostream& out) 
     {
       ElementData::serialize(out);
       out.write(reinterpret_cast<const char*>(&side_), sizeof(int));
       out.write(reinterpret_cast<const char*>(&region_), sizeof(int));
-    };
+    }
 
     void deserialize(std::istream& in) 
     {
       ElementData::deserialize(in);
       in.read(reinterpret_cast<char*>(&side_), sizeof(int));
       in.read(reinterpret_cast<char*>(&region_), sizeof(int));
-    };
+    }
 
-    inline void setSide(int side) { side_ = side; };
+    inline void setSide(int side) 
+    { 
+      side_ = side; 
+    }
 
-    inline int getSide() const { return side_; };
+    inline int getSide() const 
+    { 
+      return side_; 
+    }
 
-    inline void setRegion(int region) { region_ = region; };
+    inline void setRegion(int region) 
+    { 
+      region_ = region; 
+    }
 
-    inline int getRegion() const { return region_; };
+    inline int getRegion() const 
+    { 
+      return region_; 
+    }
 
   protected:
     int side_;
diff --git a/AMDiS/src/SystemVector.h b/AMDiS/src/SystemVector.h
index 3d53aedd..fd0c43b3 100644
--- a/AMDiS/src/SystemVector.h
+++ b/AMDiS/src/SystemVector.h
@@ -30,22 +30,15 @@
 
 namespace AMDiS {
 
-  /** \brief
-   * A system vector is a vector of dof vectors used for vector valued
-   * problems.
-   */
+  /// A system vector is a vector of dof vectors used for vector valued problems.
   class SystemVector : public Serializable
   {
   public:
-    /** \brief
-     * Creator. 
-     */
+    /// Creator. 
     class Creator 
       : public CreatorInterface<SystemVector> {
     public:
-      /** \brief
-       * Creators constructor.
-       */
+      /// Creators constructor.
       Creator(const std::string &name_,
 	      std::vector<FiniteElemSpace*> feSpace_, 
 	      int size_) 
@@ -54,15 +47,12 @@ namespace AMDiS {
 	  size(size_) 
       {}
 
-      /** \brief
-       * Destructor
-       */
+      /// Destructor
       virtual ~Creator() {}
 
-      /** \brief
-       * Implementation of CreatorInterface::create().
-       */
-      SystemVector *create() { 
+      /// Implementation of CreatorInterface::create().
+      SystemVector *create() 
+      { 
 	char number[10];
 	std::string numberedName;
 	SystemVector *result = new SystemVector(name, feSpace, size);
@@ -74,10 +64,9 @@ namespace AMDiS {
 	return result; 
       }
 
-      /** \brief
-       * Implementation of CreatorInterface::free().
-       */ 
-      void free(SystemVector *vec) { 
+      /// Implementation of CreatorInterface::free().
+      void free(SystemVector *vec) 
+      { 
 	for (int i = 0; i < size; i++) {
 	  delete vec->getDOFVector(i);
 	  vec->setDOFVector(i, NULL);
@@ -86,26 +75,18 @@ namespace AMDiS {
       }
 
     private:
-      /** \brief
-       * Name of the system vector
-       */
+      /// Name of the system vector
       std::string name;
 
-      /** \brief
-       * Finite element space used for creation.
-       */
+      /// Finite element space used for creation.
       std::vector<FiniteElemSpace*> feSpace;
 
-      /** \brief
-       * Number of component vectors to be created
-       */
+      /// Number of component vectors to be created
       int size;
     };
 
   public:
-    /** \brief
-     * Constructor.
-     */
+    /// Constructor.
     SystemVector(const std::string& name_,
 		 std::vector<FiniteElemSpace*> feSpace_, 
 		 int size)
@@ -117,92 +98,80 @@ namespace AMDiS {
       vectors.set(NULL);
     }
 
-    /** \brief
-     * Copy Constructor.
-     */
+    /// Copy Constructor.
     SystemVector(const SystemVector& rhs)
       : name(rhs.name),
 	feSpace(rhs.feSpace),
 	vectors(rhs.vectors.getSize())
       
     {
-      for (int i = 0; i < vectors.getSize(); i++) {
+      for (int i = 0; i < vectors.getSize(); i++)
 	vectors[i] = new DOFVector<double>(*rhs.vectors[i]);
-      }
     }
 
     ~SystemVector() 
     {
-      for (int i = 0; i < vectors.getSize(); i++) {
+      for (int i = 0; i < vectors.getSize(); i++)
 	delete vectors[i];
-      }
     }
 
     void createNewDOFVectors(std::string name)
     {     
-      for (int i = 0; i < vectors.getSize(); i++) {
+      for (int i = 0; i < vectors.getSize(); i++)
 	vectors[i] = new DOFVector<double>(feSpace[i], "tmp");
-      }
     }
 
-    /** \brief
-     * Sets \ref vectors[index] = vec.
-     */ 
-    inline void setDOFVector(int index, DOFVector<double> *vec) {
+    /// Sets \ref vectors[index] = vec.
+    inline void setDOFVector(int index, DOFVector<double> *vec) 
+    {
       TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
       vectors[index] = vec;
     }
 
-    /** \brief
-     * Returns \ref vectors[index].
-     */
-    inline DOFVector<double> *getDOFVector(int index) {      
+    /// Returns \ref vectors[index].
+    inline DOFVector<double> *getDOFVector(int index) 
+    {
       TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
       return vectors[index];
     }
 
-    /** \brief
-     * Returns \ref vectors[index].
-     */
-    inline const DOFVector<double> *getDOFVector(int index) const {
+    /// Returns \ref vectors[index].
+    inline const DOFVector<double> *getDOFVector(int index) const 
+    {
       TEST_EXIT_DBG(index < vectors.getSize())("invalid index\n");
       return vectors[index];
     }
 
-    /** \brief
-     * Returns sum of used vector sizes.
-     */
-    inline int getUsedSize() const {
+    /// Returns sum of used vector sizes.
+    inline int getUsedSize() const 
+    {
       int totalSize = 0;
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	totalSize += vectors[i]->getUsedSize();
-      }
       return totalSize;
     }
 
-    /** \brief
-     * Returns number of contained vectors.
-     */
-    inline int getNumVectors() const { 
+    /// Returns number of contained vectors.
+    inline int getNumVectors() const 
+    { 
       return vectors.getSize(); 
     }
 
-    inline int getSize() const {
+    inline int getSize() const 
+    {
       return vectors.getSize();
     }
 
-    /** \brief
-     * Returns the fe space for a given component.
-     */
-    inline FiniteElemSpace *getFESpace(int i) const { 
+    /// Returns the fe space for a given component.
+    inline FiniteElemSpace *getFESpace(int i) const 
+    { 
       return feSpace[i]; 
     }
 
-    /** \brief
-     * Returns the fe spaces for all components.
-     */
-    inline std::vector<FiniteElemSpace*> getFESpaces() const {
+    /// Returns the fe spaces for all components.
+    inline std::vector<FiniteElemSpace*> getFESpaces() const 
+    {
       return feSpace;
     }
 
@@ -212,7 +181,8 @@ namespace AMDiS {
      * a local index on this vector. The operator returns this local vector
      * at the local index.
      */
-    inline double& operator[](int index) {
+    inline double& operator[](int index) 
+    {
       int localIndex = index;
       int vectorIndex = 0;
 
@@ -223,10 +193,9 @@ namespace AMDiS {
       return (*(vectors[vectorIndex]))[localIndex];
     }
 
-    /** \brief
-     * For const access.
-     */
-    inline double operator[](int index) const {
+    /// For const access.
+    inline double operator[](int index) const 
+    {
       int localIndex = index;
       int vectorIndex = 0;
 
@@ -237,101 +206,91 @@ namespace AMDiS {
       return (*(vectors[vectorIndex]))[localIndex];
     }
 
-    /** \brief
-     * Sets all entries in all vectors to value.
-     */
-    inline void set(double value) {
+    /// Sets all entries in all vectors to value.
+    inline void set(double value) 
+    {
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->set(value);
-      }
     }
 
-    inline void setCoarsenOperation(CoarsenOperation op) { 
-      for (int i = 0; i < static_cast<int>(vectors.getSize()); i++) {
+    inline void setCoarsenOperation(CoarsenOperation op) 
+    { 
+      for (int i = 0; i < static_cast<int>(vectors.getSize()); i++)
 	vectors[i]->setCoarsenOperation(op); 
-      }
     }
 
-
-    /** \brief
-     * Sets all entries in all vectors to value.
-     */
-    inline SystemVector& operator=(double value) {
+    /// Sets all entries in all vectors to value.
+    inline SystemVector& operator=(double value) 
+    {
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	(*(vectors[i])) = value;
-      }
       return *this;
     }
 
-    /** \brief
-     * Assignement operator.
-     */
-    inline SystemVector& operator=(const SystemVector& rhs) {
+    /// Assignement operator.
+    inline SystemVector& operator=(const SystemVector& rhs) 
+    {
       TEST_EXIT_DBG(rhs.vectors.getSize() == vectors.getSize())("invalied sizes\n");
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	(*(vectors[i])) = (*(rhs.getDOFVector(i)));
-      }
       return *this;
     }
 
-    void serialize(std::ostream &out) {
+    void serialize(std::ostream &out) 
+    {
       int size = vectors.getSize();
       out.write(reinterpret_cast<const char*>(&size), sizeof(int));
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->serialize(out);
-      }
     }
 
-    void deserialize(std::istream &in) {
+    void deserialize(std::istream &in) 
+    {
       int size, oldSize = vectors.getSize();
       in.read(reinterpret_cast<char*>(&size), sizeof(int));
       vectors.resize(size);
-      for (int i = oldSize; i < size; i++) {
+      for (int i = oldSize; i < size; i++)
 	vectors[i] = new DOFVector<double>(feSpace[i], "");
-      }
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->deserialize(in);
-      }  
     }
 
-    void copy(const SystemVector& rhs) {
+    void copy(const SystemVector& rhs) 
+    {
       int size = vectors.getSize();
       TEST_EXIT_DBG(size == rhs.getNumVectors())("invalid sizes\n");
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->copy(*(const_cast<SystemVector&>(rhs).getDOFVector(i)));
-      }
     }
 
-    void interpol(std::vector<AbstractFunction<double, WorldVector<double> >*> *f) {
+    void interpol(std::vector<AbstractFunction<double, WorldVector<double> >*> *f) 
+    {
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->interpol((*f)[i]);
-      }
     }
 
-    void interpol(SystemVector *v, double factor) {
-      for (int i = 0; i < v->getSize(); i++) {
+    void interpol(SystemVector *v, double factor) 
+    {
+      for (int i = 0; i < v->getSize(); i++)
 	vectors[i]->interpol(v->getDOFVector(i), factor);
-      }
     }
 
-    void print() {
+    void print() 
+    {
       int size = vectors.getSize();
-      for (int i = 0; i < size; i++) {
+      for (int i = 0; i < size; i++)
 	vectors[i]->print();
-      }
     }
 
-    int calcMemoryUsage() {
+    int calcMemoryUsage() 
+    {
       int result = 0;
-
-      for (int i = 0; i < static_cast<int>(vectors.getSize()); i++) {
+      for (int i = 0; i < static_cast<int>(vectors.getSize()); i++)
 	result += vectors[i]->calcMemoryUsage();
-      }
-
       result += sizeof(SystemVector);
 
       return result;
@@ -340,165 +299,127 @@ namespace AMDiS {
       
 
   protected:
-    /** \brief
-     * Name of the system vector
-     */
+    /// Name of the system vector
     std::string name;
 
-    /** \brief
-     * Finite element space.
-     */
+    /// Finite element space.
     std::vector<FiniteElemSpace*> feSpace;
 
-    /** \brief
-     * Local dof vectors.
-     */
+    /// Local dof vectors.
     Vector<DOFVector<double>*> vectors;
   };
 
 
-  /** \brief
-   * multiplication with scalar
-   */
-  inline const SystemVector& operator*=(SystemVector& x, double d) {
+  /// multiplication with scalar
+  inline const SystemVector& operator*=(SystemVector& x, double d) 
+  {
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       *(x.getDOFVector(i)) *= d;
-    }
     return x;
   }
 
-  /** \brief
-   * scalar product
-   */
-  inline double operator*(SystemVector& x, SystemVector& y) {
-    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
-          ("invalid size\n");
+  /// scalar product
+  inline double operator*(SystemVector& x, SystemVector& y) 
+  {
+    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())("invalid size\n");
     double result = 0.0;
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       result += (*x.getDOFVector(i)) * (*y.getDOFVector(i));
-    }
     return result;
   }
 
-  /** \brief
-   * addition of two system vectors
-   */
-  inline const SystemVector& operator+=(SystemVector& x, 
-					const SystemVector& y) 
+  /// addition of two system vectors
+  inline const SystemVector& operator+=(SystemVector& x, const SystemVector& y) 
   {
-    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
-          ("invalid size\n");
+    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())("invalid size\n");
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       (*(x.getDOFVector(i))) += (*(y.getDOFVector(i)));
-    }
     return x;
   }
 
-  /**
-   * subtraction of two system vectors.
-   */
-  inline const SystemVector& operator-=(SystemVector& x, 
-					SystemVector& y) 
+  /// subtraction of two system vectors.
+  inline const SystemVector& operator-=(SystemVector& x, SystemVector& y) 
   {
-    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
-          ("invalid size\n");
+    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())("invalid size\n");
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       (*(x.getDOFVector(i))) -= (*(y.getDOFVector(i)));
-    }
     return x;
   }
 
-  /** \brief
-   * multiplication with a scalar
-   */
-  inline SystemVector operator*(SystemVector& x, double d) {
+  /// multiplication with a scalar
+  inline SystemVector operator*(SystemVector& x, double d) 
+  {
     SystemVector result = x;
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       (*(result.getDOFVector(i))) *= d;
-    }
     return result;
   }
 
-  /** \brief
-   * multiplication with a scalar
-   */
-  inline SystemVector operator*(double d, SystemVector& x) {
+  /// multiplication with a scalar
+  inline SystemVector operator*(double d, SystemVector& x) 
+  {
     SystemVector result = x;
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       (*(result.getDOFVector(i))) *= d;
-    }
     return result;
   }
 
-  /** \brief
-   * addition of two system vectors
-   */
-  inline SystemVector operator+(const SystemVector& x,
-				const SystemVector& y)
+  /// addition of two system vectors
+  inline SystemVector operator+(const SystemVector& x, const SystemVector& y)
   {
-    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
-      ("invalid size\n");
+    TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())("invalid size\n");
     SystemVector result = x;
     int size = x.getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       (*(result.getDOFVector(i))) += (*(y.getDOFVector(i)));
-    }
     return result;
   }
 
-  /** \brief
-   * Calls SystemVector::set(). Used for solving.
-   */
-  inline void set(SystemVector& x, double value) {
+  /// Calls SystemVector::set(). Used for solving.
+  inline void set(SystemVector& x, double value) 
+  {
     x.set(value);
   } 
 
-  /** \brief
-   * Calls SystemVector::set(). Used for solving.
-   */
-  inline void setValue(SystemVector& x, double value) {
+  /// Calls SystemVector::set(). Used for solving.
+  inline void setValue(SystemVector& x, double value) 
+  {
     x.set(value);
   }
 
-  /** \brief
-   * Norm of system vector.
-   */
-  inline double norm(SystemVector* x) {
+  /// Norm of system vector.
+  inline double norm(SystemVector* x) 
+  {
     double result = 0.0;
     int size = x->getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       result += x->getDOFVector(i)->squareNrm2();
-    }
     return sqrt(result);
   }
 
-  /** \brief
-   * L2 norm of system vector.
-   */
-  inline double L2Norm(SystemVector* x) {
+  /// L2 norm of system vector.
+  inline double L2Norm(SystemVector* x) 
+  {
     double result = 0.0;
     int size = x->getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       result += x->getDOFVector(i)->L2NormSquare();
-    }
     return sqrt(result);
   }
 
-  /** \brief
-   * H1 norm of system vector.
-   */
-  inline double H1Norm(SystemVector* x) {
+  /// H1 norm of system vector.
+  inline double H1Norm(SystemVector* x) 
+  {
     double result = 0.0;
     int size = x->getNumVectors();
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       result += x->getDOFVector(i)->H1NormSquare();
-    }
     return sqrt(result);
   }
 
@@ -521,21 +442,17 @@ namespace AMDiS {
       if (!add) 
 	result.getDOFVector(i)->set(0.0);
 
-      for (int j = 0; j < size; j++) {
-	if (matrix[i][j]) {
+      for (int j = 0; j < size; j++)
+	if (matrix[i][j])
 	  mv<double>(NoTranspose, 
 		     *(matrix[i][j]), 
 		     *(x.getDOFVector(j)), 
 		     *(result.getDOFVector(i)),
 		     true);
-	}
-      }
     }
   }
 
-  /** \brief
-   * y = a*x + y;
-   */
+  /// y = a*x + y;
   inline void axpy(double a, SystemVector& x, SystemVector& y)
   {
     TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
@@ -547,33 +464,29 @@ namespace AMDiS {
 #ifdef _OPENMP
 #pragma omp parallel for schedule(static, 1) num_threads(min(size, omp_get_max_threads()))
 #endif
-    for (i = 0; i < size; i++) {
+    for (i = 0; i < size; i++)
       axpy(a, *(x.getDOFVector(i)), *(y.getDOFVector(i)));
-    }
   }
 
-  /** \brief
-   * y = x + a*y
-   */
+  /// y = x + a*y
   inline void xpay(double a, SystemVector& x, SystemVector& y)
   {
     TEST_EXIT_DBG(x.getNumVectors() == y.getNumVectors())
           ("invalid size\n");
     int size = x.getNumVectors();
 
-    for (int i = 0; i < size; i++) {
+    for (int i = 0; i < size; i++)
       xpay(a, *(x.getDOFVector(i)), *(y.getDOFVector(i)));
-    }
   }
 
-  /** \brief
-   * Returns SystemVector::getUsedSize().
-   */
-  inline int size(SystemVector* vec) {
+  /// Returns SystemVector::getUsedSize().
+  inline int size(SystemVector* vec) 
+  {
     return vec->getUsedSize();
   }
 
-  inline void print(SystemVector* vec) {
+  inline void print(SystemVector* vec) 
+  {
     vec->print();
   }
 
diff --git a/AMDiS/src/TecPlotWriter.h b/AMDiS/src/TecPlotWriter.h
index 37e271db..ad2a4811 100644
--- a/AMDiS/src/TecPlotWriter.h
+++ b/AMDiS/src/TecPlotWriter.h
@@ -22,19 +22,13 @@
 #ifndef AMDIS_TEC_PLOT_WRITER_H
 #define AMDIS_TEC_PLOT_WRITER_H
 
-#include "FixVec.h"
 #include <fstream>
 #include <vector>
+#include "FixVec.h"
+#include "AMDiS_fwd.h"
 
 namespace AMDiS {
 
-  class ElInfo;
-  class Mesh;
-
-  // ============================================================================
-  // ===== class TecPlotWriter ==================================================
-  // ============================================================================
-
   /** \ingroup Output
    * \brief
    * Writes a DOFVector in TecPlot format to a ascii file
@@ -63,16 +57,19 @@ namespace AMDiS {
     class VertexInfo {
     public:
       WorldVector<double> coord;
-      int         vertex_index;
+
+      int vertex_index;
 
     public:
-      inline bool operator==(const WorldVector<double>& coor) {
+      inline bool operator==(const WorldVector<double>& coor) 
+      {
 	return (coor == coord);
-      };
+      }
 
-      inline bool operator!=(const WorldVector<double>& coor) {
+      inline bool operator!=(const WorldVector<double>& coor) 
+      {
 	return !(*this == coor);
-      };
+      }
     };
 
     typedef std::vector<VertexInfo> DOFCoords;
diff --git a/AMDiS/src/Tetrahedron.h b/AMDiS/src/Tetrahedron.h
index e2c4eae4..25797552 100644
--- a/AMDiS/src/Tetrahedron.h
+++ b/AMDiS/src/Tetrahedron.h
@@ -49,17 +49,19 @@ namespace AMDiS {
     }
 
     /// implements Element::getVertexOfEdge
-    inline int getVertexOfEdge(int i, int j) const {
+    inline int getVertexOfEdge(int i, int j) const 
+    {
       return vertexOfEdge[i][j];
     }
 
     /// implements Element::getVertexOfPosition
     int getVertexOfPosition(GeoIndex position,
-			    int      positionIndex,
-			    int      vertexIndex) const;
+			    int positionIndex,
+			    int vertexIndex) const;
 
 
-    virtual int getPositionOfVertex(int side, int vertex) const {
+    virtual int getPositionOfVertex(int side, int vertex) const 
+    {
       static int positionOfVertex[4][4] = {{-1,0,1,2},
 					   {0,-1,1,2},
 					   {0,1,-1,2},
@@ -68,8 +70,9 @@ namespace AMDiS {
     }
 
     /// implements Element::getGeo
-    inline int getGeo(GeoIndex i) const {
-      switch(i) {
+    inline int getGeo(GeoIndex i) const 
+    {
+      switch (i) {
       case VERTEX: case PARTS: case NEIGH:
 	return 4;
 	break;
@@ -103,7 +106,8 @@ namespace AMDiS {
 					     FixVec<int,WORLD> *vec) const;
 
     /// implements Element::isLine. Returns false because this element is a Tetrahedron
-    inline bool isLine() const { 
+    inline bool isLine() const 
+    { 
       return false; 
     }
 
@@ -111,7 +115,8 @@ namespace AMDiS {
      * implements Element::isTriangle. Returns false because this element is a 
      * Tetrahedron
      */
-    inline bool isTriangle() const { 
+    inline bool isTriangle() const 
+    { 
       return false; 
     }
  
@@ -119,11 +124,13 @@ namespace AMDiS {
      * implements Element::isTetrahedron. Returns true because this element is a 
      * Tetrahedron
      */
-    inline bool isTetrahedron() const { 
+    inline bool isTetrahedron() const 
+    { 
       return true; 
     }
  
-    std::string getTypeName() const { 
+    std::string getTypeName() const 
+    { 
       return "Tetrahedron"; 
     }
 
@@ -180,7 +187,8 @@ namespace AMDiS {
     static const int edgeOfFace[4][3];
 
     /// implements Element::getSideOfChild()
-    virtual int getSideOfChild(int child, int side, int elType = 0) const {
+    virtual int getSideOfChild(int child, int side, int elType = 0) const 
+    {
       FUNCNAME("Tetrahedron::getSideOfChild()");
       TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
       TEST_EXIT_DBG(side >= 0 && side <= 3)("side must be between 0 and 3\n");
@@ -189,7 +197,8 @@ namespace AMDiS {
     }
 
     /// implements Element::getVertexOfParent()
-    virtual int getVertexOfParent(int child, int side, int elType = 0) const {
+    virtual int getVertexOfParent(int child, int side, int elType = 0) const 
+    {
       FUNCNAME("Tetrahedron::getVertexOfParent()");
       TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
       TEST_EXIT_DBG(side >= 0 && side <= 3)("side must be between 0 and 3\n");
@@ -197,7 +206,8 @@ namespace AMDiS {
       return vertexOfParent[elType][child][side];
     }
 
-    inline int getEdgeOfFace(int face, int edge) const {
+    inline int getEdgeOfFace(int face, int edge) const 
+    {
       TEST_EXIT_DBG(face >= 0 && face < 4)("invalid face\n");
       TEST_EXIT_DBG(edge >= 0 && edge < 3)("invalid edge\n");
       return edgeOfFace[face][edge];
diff --git a/AMDiS/src/TimedObject.h b/AMDiS/src/TimedObject.h
deleted file mode 100644
index df73b4f4..00000000
--- a/AMDiS/src/TimedObject.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// ============================================================================
-// ==                                                                        ==
-// == AMDiS - Adaptive multidimensional simulations                          ==
-// ==                                                                        ==
-// ============================================================================
-// ==                                                                        ==
-// ==  crystal growth group                                                  ==
-// ==                                                                        ==
-// ==  Stiftung caesar                                                       ==
-// ==  Ludwig-Erhard-Allee 2                                                 ==
-// ==  53175 Bonn                                                            ==
-// ==  germany                                                               ==
-// ==                                                                        ==
-// ============================================================================
-// ==                                                                        ==
-// ==  http://www.caesar.de/cg/AMDiS                                         ==
-// ==                                                                        ==
-// ============================================================================
-
-/** \file TimedObject.h */
-
-#ifndef AMDIS_TIMEDOBJECT_H
-#define AMDIS_TIMEDOBJECT_H
-
-namespace AMDiS {
-
-  // ===========================================================================
-  // ===== class TimedObject ===================================================
-  // ===========================================================================
-
-  /** \brief
-   * This class can be used as base class for time dependent objects where
-   * different objects refer to the same time. Herefore a pointer to
-   * a double value is stored, pointing to a time value, which can be
-   * managed in one central object, maybe the problem class.
-   */
-  class TimedObject
-  {
-  public:
-    /** \brief
-     * Constructor.
-     */
-    TimedObject() : timePtr(NULL) {};
-
-    /** \brief
-     * Sets the time pointer.
-     */
-    inline void setTimePtr(double *timePtr_) { timePtr = timePtr_; };
-
-    /** \brief
-     * Returns the time pointer.
-     */
-    inline double *getTimePtr() { return timePtr; };
-  protected:
-    /** \brief
-     * Pointer to the externally managed time value.
-     */
-    double *timePtr;
-  };
-
-}
-
-#endif // AMDIS_TIMEDOBJECT_H
diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h
index 4c9227b7..f2e3e421 100644
--- a/AMDiS/src/Traverse.h
+++ b/AMDiS/src/Traverse.h
@@ -117,16 +117,19 @@ namespace AMDiS {
     void fillRefinementPath(ElInfo& elInfo, const ElInfo& upperElInfo);
 
     /// Is used for parallel mesh traverse.
-    inline void setMyThreadId(int myThreadId) {
+    inline void setMyThreadId(int myThreadId) 
+    {
       myThreadId_ = myThreadId;
     }
 
     /// Is used for parallel mesh traverse.
-    inline void setMaxThreads(int maxThreads) {
+    inline void setMaxThreads(int maxThreads) 
+    {
       maxThreads_ = maxThreads;
     }
 
-    int getStackData(std::vector<ElInfo*> &elInfos, std::vector<int> &infos) {
+    int getStackData(std::vector<ElInfo*> &elInfos, std::vector<int> &infos) 
+    {
       elInfos = elinfo_stack;
       infos = info_stack;
 
@@ -150,7 +153,8 @@ namespace AMDiS {
      * Avoids copy of a traverse stack. If copy should be possible
      * the operator must be implemented (deep copy not flat copy!)
      */
-    void operator=(const TraverseStack& /*rhs*/) {
+    void operator=(const TraverseStack& /*rhs*/) 
+    {
       FUNCNAME("TraverseStack::operator=()");
       ERROR_EXIT("not implemented");
     }
@@ -159,7 +163,8 @@ namespace AMDiS {
      * Avoids copy of a traverse stack. If copy should be possible
      * the operator must be implemented (deep copy not flat copy!)
      */
-    TraverseStack(const TraverseStack&) {
+    TraverseStack(const TraverseStack&) 
+    {
       FUNCNAME("TraverseStack::TraverseStack()");
       ERROR_EXIT("not implemented");
     }
diff --git a/AMDiS/src/TraverseParallel.h b/AMDiS/src/TraverseParallel.h
index 51a0c0d6..744e7f05 100644
--- a/AMDiS/src/TraverseParallel.h
+++ b/AMDiS/src/TraverseParallel.h
@@ -42,14 +42,13 @@ namespace AMDiS {
 
     ElInfo* traverseFirst(Mesh *mesh, int level, Flag fill_flag);
 
-    inline ElInfo* traverseNext(ElInfo* elinfo_old) {
+    inline ElInfo* traverseNext(ElInfo* elinfo_old) 
+    {
       return stacks_[omp_get_thread_num()]->traverseNext(elinfo_old);
     }
 
   private:
-    /** \brief
-     * Number of threads using the stack in parallel.
-     */
+    /// Number of threads using the stack in parallel.
     int nThreads_;
 
     std::vector<TraverseStack*> stacks_;
diff --git a/AMDiS/src/Triangle.h b/AMDiS/src/Triangle.h
index 91c8094e..4a279cc4 100644
--- a/AMDiS/src/Triangle.h
+++ b/AMDiS/src/Triangle.h
@@ -37,42 +37,34 @@ namespace AMDiS {
   class Triangle : public Element
   {
   public:
-    /** \brief
-     * calls base class contructor.
-     */
+    /// calls base class contructor.
     Triangle(Mesh* aMesh) 
       : Element(aMesh) 
     {}
 
     ~Triangle() {}
 
-    /** \brief
-     * implements Element::clone
-     */
-    inline Element *clone() { 
+    /// implements Element::clone
+    inline Element *clone() 
+    { 
       return new Triangle(mesh); 
     }
 
-
-    /** \brief
-     * implements Element::getVertexOfEdge
-     */
-    inline int getVertexOfEdge(int i, int j) const {
+    /// implements Element::getVertexOfEdge
+    inline int getVertexOfEdge(int i, int j) const 
+    {
       return vertexOfEdge[i][j];
     }
 
-    /** \brief
-     * implements Element::getVertexOfPosition
-     */
+    /// implements Element::getVertexOfPosition
     int getVertexOfPosition(GeoIndex position,
 			    int positionIndex,
 			    int vertexIndex) const;
 
-    /** \brief
-     * implements Element::getGeo
-     */
-    inline int getGeo(GeoIndex i) const {
-      switch(i) {
+    /// implements Element::getGeo
+    inline int getGeo(GeoIndex i) const 
+    {
+      switch (i) {
       case VERTEX: case PARTS: case NEIGH:
 	return 3;
 	break;
@@ -98,30 +90,22 @@ namespace AMDiS {
       }
     }
 
-    /** \brief
-     * implements Element::hasSide
-     */
+    /// implements Element::hasSide
     bool hasSide(Element* sideElem) const;
 
-    /** \brief
-     * implements Element::sortFaceIndices
-     */
+    /// implements Element::sortFaceIndices
     const FixVec<int,WORLD>& sortFaceIndices(int face, 
 					     FixVec<int,WORLD> *vec) const;
 
-    /** \brief
-     * implements Element::isLine. Returns false because this element is a 
-     * Triangle
-     */
-    inline bool isLine() const { 
+    /// implements Element::isLine. Returns false because this element is a Triangle
+    inline bool isLine() const 
+    { 
       return false; 
     }
  
-    /** \brief
-     * implements Element::isTriangle. Returns true because this element is a 
-     * Triangle
-     */
-    inline bool isTriangle() const { 
+    /// implements Element::isTriangle. Returns true because this element is a Triangle
+    inline bool isTriangle() const 
+    { 
       return true; 
     }
 
@@ -129,44 +113,44 @@ namespace AMDiS {
      * implements Element::isTetrahedron. Returns false because this element is a 
      * Triangle
      */
-    inline bool isTetrahedron() const { 
+    inline bool isTetrahedron() const 
+    { 
       return false; 
     }
 
-    /** \brief
-     * implements Element::getSideOfChild()
-     */
-    virtual int getSideOfChild(int child, int side, int) const {
+    /// implements Element::getSideOfChild()
+    virtual int getSideOfChild(int child, int side, int) const 
+    {
       FUNCNAME("Triangle::getSideOfChild()");
       TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
       TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
       return sideOfChild[child][side];
     }
 
-    /** \brief
-     * implements Element::getVertexOfParent()
-     */
-    virtual int getVertexOfParent(int child, int side, int=0) const {
+    /// implements Element::getVertexOfParent()
+    virtual int getVertexOfParent(int child, int side, int = 0) const 
+    {
       FUNCNAME("Triangle::getVertexOfParent()");
       TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n");
       TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 2\n");
       return vertexOfParent[child][side];
     }
 
-    virtual int getPositionOfVertex(int side, int vertex) const {
+    virtual int getPositionOfVertex(int side, int vertex) const 
+    {
       static int positionOfVertex[3][3] = {{-1,0,1},{1,-1,0},{0,1,-1}};
       return positionOfVertex[side][vertex];
-    };
+    }
 
-    inline int getEdgeOfFace(int face, int edge) const {
+    inline int getEdgeOfFace(int face, int edge) const 
+    {
       TEST_EXIT_DBG(face == 0)("face must be zero at triangle\n");
       TEST_EXIT_DBG(edge >= 0 && edge < 3)("invalid edge\n");
       return edge;
     }
 
-    // ===== Serializable implementation =====
-  
-    std::string getTypeName() const { 
+    std::string getTypeName() const 
+    { 
       return "Triangle"; 
     }
 
-- 
GitLab