From d8885691a70fc58ecd1f2d567c629b3923f5bc0c Mon Sep 17 00:00:00 2001
From: wolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Mon, 23 Mar 1998 10:20:25 +0000
Subject: [PATCH] Code cleanup; use more templates if gcc2.8 understands them,
 i.e. use the TYPENAME keyword.

git-svn-id: https://svn.dealii.org/trunk@91 0785d39b-7218-0410-832d-ea1e28bc413d
---
 deal.II/deal.II/Attic/examples/Makefile      |   2 +-
 deal.II/deal.II/source/dofs/dof_handler.cc   | 222 +++++++++--------
 deal.II/deal.II/source/fe/fe.cc              |  56 +----
 deal.II/deal.II/source/grid/tria.cc          | 241 +++++++++----------
 deal.II/deal.II/source/numerics/assembler.cc |  48 +---
 tests/big-tests/Makefile                     |   2 +-
 6 files changed, 262 insertions(+), 309 deletions(-)

diff --git a/deal.II/deal.II/Attic/examples/Makefile b/deal.II/deal.II/Attic/examples/Makefile
index 5825f83c2e..7ecbf0cb94 100644
--- a/deal.II/deal.II/Attic/examples/Makefile
+++ b/deal.II/deal.II/Attic/examples/Makefile
@@ -36,7 +36,7 @@ examples: $(cc-files:.cc=)
 
 grid/grid_test: grid/grid_test.o $(LIBFILES)
 	@echo ================= Linking $@
-	@$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS)
+	@$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS.g)
 
 dof/dof_test: dof/dof_test.o $(LIBFILES.g)
 	@echo ================= Linking $@
diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc
index b172bab594..8dec8ca805 100644
--- a/deal.II/deal.II/source/dofs/dof_handler.cc
+++ b/deal.II/deal.II/source/dofs/dof_handler.cc
@@ -28,6 +28,7 @@ DoFHandler<dim>::~DoFHandler () {
 
 
 
+
 DoFHandler<1>::raw_cell_iterator
 DoFHandler<1>::begin_raw (const unsigned int level) const {
   return begin_raw_line (level);
@@ -172,18 +173,10 @@ DoFHandler<2>::last_active (const unsigned int level) const {
 
 
 //------------------------------------------------------------------
-DoFHandler<1>::raw_cell_iterator
-DoFHandler<1>::begin_raw_line (const unsigned int level) const {
-  return raw_line_iterator (tria,
-			    tria->begin_raw_line(level)->level(),
-			    tria->begin_raw_line(level)->index(),
-			    this);
-};
-
-
 
-DoFHandler<2>::raw_line_iterator
-DoFHandler<2>::begin_raw_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::raw_line_iterator
+DoFHandler<dim>::begin_raw_line (const unsigned int level) const {
   return raw_line_iterator (tria,
 			    tria->begin_raw_line(level)->level(),
 			    tria->begin_raw_line(level)->index(),
@@ -192,18 +185,9 @@ DoFHandler<2>::begin_raw_line (const unsigned int level) const {
 
 
 
-DoFHandler<1>::line_iterator
-DoFHandler<1>::begin_line (const unsigned int level) const {
-  return line_iterator (tria,
-			tria->begin_line(level)->level(),
-			tria->begin_line(level)->index(),
-			this);
-};
-
-
-
-DoFHandler<2>::line_iterator
-DoFHandler<2>::begin_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::line_iterator
+DoFHandler<dim>::begin_line (const unsigned int level) const {
   return line_iterator (tria,
 			tria->begin_line(level)->level(),
 			tria->begin_line(level)->index(),
@@ -212,8 +196,9 @@ DoFHandler<2>::begin_line (const unsigned int level) const {
 
 
 
-DoFHandler<1>::active_line_iterator
-DoFHandler<1>::begin_active_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::active_line_iterator
+DoFHandler<dim>::begin_active_line (const unsigned int level) const {
   return active_line_iterator (tria,
 			       tria->begin_active_line(level)->level(),
 			       tria->begin_active_line(level)->index(),
@@ -222,18 +207,17 @@ DoFHandler<1>::begin_active_line (const unsigned int level) const {
 
 
 
-DoFHandler<2>::active_line_iterator
-DoFHandler<2>::begin_active_line (const unsigned int level) const {
-  return active_line_iterator (tria,
-			       tria->begin_active_line(level)->level(),
-			       tria->begin_active_line(level)->index(),
-			       this);
+DoFHandler<1>::raw_quad_iterator
+DoFHandler<1>::begin_raw_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
 
-DoFHandler<2>::raw_quad_iterator
-DoFHandler<2>::begin_raw_quad (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::raw_quad_iterator
+DoFHandler<dim>::begin_raw_quad (const unsigned int level) const {
   return raw_quad_iterator (tria,
 			    tria->begin_raw_quad(level)->level(),
 			    tria->begin_raw_quad(level)->index(),
@@ -242,8 +226,17 @@ DoFHandler<2>::begin_raw_quad (const unsigned int level) const {
 
 
 
-DoFHandler<2>::quad_iterator
-DoFHandler<2>::begin_quad (const unsigned int level) const {
+DoFHandler<1>::quad_iterator
+DoFHandler<1>::begin_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+};
+
+
+
+template <int dim>
+typename DoFHandler<dim>::quad_iterator
+DoFHandler<dim>::begin_quad (const unsigned int level) const {
   return quad_iterator (tria,
 			tria->begin_quad(level)->level(),
 			tria->begin_quad(level)->index(),
@@ -252,8 +245,17 @@ DoFHandler<2>::begin_quad (const unsigned int level) const {
 
 
 
-DoFHandler<2>::active_quad_iterator
-DoFHandler<2>::begin_active_quad (const unsigned int level) const {
+DoFHandler<1>::active_quad_iterator
+DoFHandler<1>::begin_active_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+};
+
+
+
+template <int dim>
+typename DoFHandler<dim>::active_quad_iterator
+DoFHandler<dim>::begin_active_quad (const unsigned int level) const {
   return active_quad_iterator (tria,
 			       tria->begin_active_quad(level)->level(),
 			       tria->begin_active_quad(level)->index(),
@@ -262,40 +264,34 @@ DoFHandler<2>::begin_active_quad (const unsigned int level) const {
 
 
 
-DoFHandler<1>::raw_line_iterator
-DoFHandler<1>::end_line () const {
+template <int dim>
+typename DoFHandler<dim>::raw_line_iterator
+DoFHandler<dim>::end_line () const {
   return raw_line_iterator (tria, -1, -1, this);
 };
 
 
 
-DoFHandler<2>::raw_line_iterator
-DoFHandler<2>::end_line () const {
-  return raw_line_iterator (tria, -1, -1, this);
+DoFHandler<1>::raw_quad_iterator
+DoFHandler<1>::end_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
 
-DoFHandler<2>::raw_quad_iterator
-DoFHandler<2>::end_quad () const {
+template <int dim>
+typename DoFHandler<dim>::raw_quad_iterator
+DoFHandler<dim>::end_quad () const {
   return raw_quad_iterator (tria, -1, -1, this);
 };
 
 
 
 
-DoFHandler<1>::raw_line_iterator
-DoFHandler<1>::last_raw_line (const unsigned int level) const {
-  return raw_line_iterator (tria,
-			    tria->last_raw_line(level)->level(),
-			    tria->last_raw_line(level)->index(),
-			    this);
-};
-
-
-
-DoFHandler<2>::raw_line_iterator
-DoFHandler<2>::last_raw_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::raw_line_iterator
+DoFHandler<dim>::last_raw_line (const unsigned int level) const {
   return raw_line_iterator (tria,
 			    tria->last_raw_line(level)->level(),
 			    tria->last_raw_line(level)->index(),
@@ -304,18 +300,9 @@ DoFHandler<2>::last_raw_line (const unsigned int level) const {
 
 
 
-DoFHandler<1>::line_iterator
-DoFHandler<1>::last_line (const unsigned int level) const {
-  return line_iterator (tria,
-			tria->last_line(level)->level(),
-			tria->last_line(level)->index(),
-			this);
-};
-
-
-
-DoFHandler<2>::line_iterator
-DoFHandler<2>::last_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::line_iterator
+DoFHandler<dim>::last_line (const unsigned int level) const {
   return line_iterator (tria,
 			tria->last_line(level)->level(),
 			tria->last_line(level)->index(),
@@ -324,8 +311,9 @@ DoFHandler<2>::last_line (const unsigned int level) const {
 
 
 
-DoFHandler<1>::active_line_iterator
-DoFHandler<1>::last_active_line (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::active_line_iterator
+DoFHandler<dim>::last_active_line (const unsigned int level) const {
   return active_line_iterator (tria,
 			       tria->last_active_line(level)->level(),
 			       tria->last_active_line(level)->index(),
@@ -334,18 +322,16 @@ DoFHandler<1>::last_active_line (const unsigned int level) const {
 
 
 
-DoFHandler<2>::active_line_iterator
-DoFHandler<2>::last_active_line (const unsigned int level) const {
-  return active_line_iterator (tria,
-			       tria->last_active_line(level)->level(),
-			       tria->last_active_line(level)->index(),
-			       this);
+DoFHandler<1>::raw_quad_iterator
+DoFHandler<1>::last_raw_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
-
-DoFHandler<2>::raw_quad_iterator
-DoFHandler<2>::last_raw_quad (const unsigned int level) const {
+template <int dim>
+typename DoFHandler<dim>::raw_quad_iterator
+DoFHandler<dim>::last_raw_quad (const unsigned int level) const {
   return raw_quad_iterator (tria,
 			    tria->last_raw_quad(level)->level(),
 			    tria->last_raw_quad(level)->index(),
@@ -355,8 +341,17 @@ DoFHandler<2>::last_raw_quad (const unsigned int level) const {
 
 
 
-DoFHandler<2>::quad_iterator
-DoFHandler<2>::last_quad (const unsigned int level) const {
+DoFHandler<1>::quad_iterator
+DoFHandler<1>::last_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+};
+
+
+
+template <int dim>
+typename DoFHandler<dim>::quad_iterator
+DoFHandler<dim>::last_quad (const unsigned int level) const {
   return quad_iterator (tria,
 			tria->last_quad(level)->level(),
 			tria->last_quad(level)->index(),
@@ -366,8 +361,17 @@ DoFHandler<2>::last_quad (const unsigned int level) const {
 
 
 
-DoFHandler<2>::active_quad_iterator
-DoFHandler<2>::last_active_quad (const unsigned int level) const {
+DoFHandler<1>::active_quad_iterator
+DoFHandler<1>::last_active_quad (const unsigned int) const {
+  Assert (false, ExcNotImplemented());
+  return 0;
+};
+
+
+
+template <int dim>
+typename DoFHandler<dim>::active_quad_iterator
+DoFHandler<dim>::last_active_quad (const unsigned int level) const {
   return active_quad_iterator (tria,
 			       tria->last_active_quad(level)->level(),
 			       tria->last_active_quad(level)->index(),
@@ -377,64 +381,74 @@ DoFHandler<2>::last_active_quad (const unsigned int level) const {
 
 
 
-DoFHandler<1>::raw_line_iterator
-DoFHandler<1>::last_raw_line () const {
+template <int dim>
+typename DoFHandler<dim>::raw_line_iterator
+DoFHandler<dim>::last_raw_line () const {
   return last_raw_line (levels.size()-1);
 };
 
 
 
-DoFHandler<2>::raw_line_iterator
-DoFHandler<2>::last_raw_line () const {
-  return last_raw_line (levels.size()-1);
+DoFHandler<1>::raw_quad_iterator
+DoFHandler<1>::last_raw_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
 
-DoFHandler<2>::raw_quad_iterator
-DoFHandler<2>::last_raw_quad () const {
+template <int dim>
+typename DoFHandler<dim>::raw_quad_iterator
+DoFHandler<dim>::last_raw_quad () const {
   return last_raw_quad (levels.size()-1);
 };
 
 
 
-DoFHandler<1>::line_iterator
-DoFHandler<1>::last_line () const {
+template <int dim>
+typename DoFHandler<dim>::line_iterator
+DoFHandler<dim>::last_line () const {
   return last_line (levels.size()-1);
 };
 
 
 
-DoFHandler<2>::line_iterator
-DoFHandler<2>::last_line () const {
-  return last_line (levels.size()-1);
+DoFHandler<1>::quad_iterator
+DoFHandler<1>::last_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
 
-DoFHandler<2>::quad_iterator
-DoFHandler<2>::last_quad () const {
+template <int dim>
+typename DoFHandler<dim>::quad_iterator
+DoFHandler<dim>::last_quad () const {
   return last_quad (levels.size()-1);
 };
 
 
 
-DoFHandler<1>::active_line_iterator
-DoFHandler<1>::last_active_line () const {
+template <int dim>
+typename DoFHandler<dim>::active_line_iterator
+DoFHandler<dim>::last_active_line () const {
   return last_active_line (levels.size()-1);
 };
 
 
 
-DoFHandler<2>::active_line_iterator
-DoFHandler<2>::last_active_line () const {
-  return last_active_line (levels.size()-1);
+
+DoFHandler<1>::active_quad_iterator
+DoFHandler<1>::last_active_quad () const {
+  Assert (false, ExcNotImplemented());
+  return 0;
 };
 
 
 
-DoFHandler<2>::active_quad_iterator
-DoFHandler<2>::last_active_quad () const {
+template <int dim>
+typename DoFHandler<dim>::active_quad_iterator
+DoFHandler<dim>::last_active_quad () const {
   return last_active_quad (levels.size()-1);
 };
 
diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc
index 97f560712a..7c591c7c4e 100644
--- a/deal.II/deal.II/source/fe/fe.cc
+++ b/deal.II/deal.II/source/fe/fe.cc
@@ -85,9 +85,9 @@ double FEValues<dim>::JxW (const unsigned int i) const {
 
 
 
-void FEValues<1>::reinit (const Triangulation<1>::cell_iterator &cell,
-			  const FiniteElement<1>                &fe) {
-  const unsigned int dim=1;
+template <int dim>
+void FEValues<dim>::reinit (const typename Triangulation<dim>::cell_iterator &cell,
+			    const FiniteElement<dim>                         &fe) {
 				   // fill jacobi matrices and real
 				   //quadrature points
   fe.fill_fe_values (cell,
@@ -122,37 +122,6 @@ void FEValues<1>::reinit (const Triangulation<1>::cell_iterator &cell,
 
 
 
-void FEValues<2>::reinit (const Triangulation<2>::cell_iterator &cell,
-			  const FiniteElement<2>                &fe) {
-  const unsigned int dim=2;
-				   // fill jacobi matrices and real
-				   //quadrature points
-  fe.fill_fe_values (cell,
-		     unit_quadrature_points,
-		     jacobi_matrices,
-		     quadrature_points);
-				   // compute gradients on real element
-  for (unsigned int i=0; i<fe.total_dofs; ++i)
-    for (unsigned int j=0; j<n_quadrature_points; ++j)
-      for (unsigned int s=0; s<dim; ++s)
-	{
-	  shape_gradients[i][j](s) = 0;
-
-					   // (grad psi)_s =
-					   // (grad_{\xi\eta})_b J_{bs}
-					   // with J_{bs}=(d\xi_b)/(dx_s)
-	  for (unsigned int b=0; b<dim; ++b)
-	    shape_gradients[i][j](s)
-	      +=
-	      unit_shape_gradients[i][j](b) * jacobi_matrices[j](b,s);
-	};
-  
-				   // refer to the general doc for
-				   // why we take the inverse of the
-				   // determinant
-  for (unsigned int i=0; i<n_quadrature_points; ++i)
-    JxW_values[i] = weights[i] / jacobi_matrices[i].determinant();
-};
 
 
 
@@ -225,19 +194,12 @@ Point<dim> FiniteElementBase<dim>::shape_grad (const unsigned int,
 
 
 
-void FiniteElementBase<1>::fill_fe_values (const Triangulation<1>::cell_iterator &,
-					   const vector<Point<1> > &,
-					   vector<dFMatrix> &,
-					   vector<Point<1> > &) const {
-  Assert (false, ExcPureFunctionCalled());
-};
-
 
-
-void FiniteElementBase<2>::fill_fe_values (const Triangulation<2>::cell_iterator &,
-					   const vector<Point<2> > &,
-					   vector<dFMatrix> &,
-					   vector<Point<2> > &) const {
+template <int dim>
+void FiniteElementBase<dim>::fill_fe_values (const typename Triangulation<dim>::cell_iterator &,
+					     const vector<Point<dim> > &,
+					     vector<dFMatrix> &,
+					     vector<Point<dim> > &) const {
   Assert (false, ExcPureFunctionCalled());
 };
 
@@ -259,7 +221,7 @@ void FiniteElement<1>::fill_fe_values (const Triangulation<1>::cell_iterator &ce
 				       vector<dFMatrix>  &jacobians,
 				       vector<Point<1> > &points) const {
 				   // local mesh width
-  double h=(cell->vertex(1)(0) - cell->vertex(0)(0));
+  const double h=(cell->vertex(1)(0) - cell->vertex(0)(0));
 
   for (unsigned int i=0; i<points.size(); ++i) 
     {
diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc
index 1b76c32dc4..d19912d962 100644
--- a/deal.II/deal.II/source/grid/tria.cc
+++ b/deal.II/deal.II/source/grid/tria.cc
@@ -403,7 +403,7 @@ void Triangulation<2>::create_hypercube (const double left,
   for (unsigned int j=0; j<4; ++j)
     cells[0].push_back (cell_vertices[0][j]);
   
-  create_triangulation (vector<Point<2> >(&vertices[0], &vertices[8]),
+  create_triangulation (vector<Point<2> >(&vertices[0], &vertices[4]),
 			cells);
 };
 
@@ -908,55 +908,52 @@ Triangulation<2>::last_active (const unsigned int level) const {
 
 
 
-TriaDimensionInfo<1>::raw_line_iterator
-Triangulation<1>::begin_raw_line (unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_line_iterator
+Triangulation<dim>::begin_raw_line (unsigned int level) const {
   Assert (level<levels.size(),
 	  ExcInvalidLevel(level));
 
 				   // does this level have cells?
   if (levels[level]->lines.lines.size() == 0)
-    return end();
+    return end_line();
   
-  return raw_cell_iterator ((Triangulation<1>*)this,
+  return raw_line_iterator ((Triangulation<dim>*)this,
 			    level,
 			    0);
 };
 
 
 
-TriaDimensionInfo<2>::raw_line_iterator
-Triangulation<2>::begin_raw_line (unsigned int level) const {
-  Assert (level<levels.size(),
-	  ExcInvalidLevel(level));
 
-				   // does this level have cells?
-  if (levels[level]->lines.lines.size() == 0)
-    return end_line();
-  
-  return raw_line_iterator ((Triangulation<2>*)this,
-			    level,
-			    0);
+TriaDimensionInfo<1>::raw_quad_iterator
+Triangulation<1>::begin_raw_quad (unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::raw_quad_iterator
-Triangulation<2>::begin_raw_quad (unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_quad_iterator
+Triangulation<dim>::begin_raw_quad (unsigned int level) const {
   Assert (level<levels.size(),
 	  ExcInvalidLevel(level));
   
   if (levels[level]->quads.quads.size() == 0)
     return end_quad();
   
-  return raw_quad_iterator ((Triangulation<2>*)this,
+  return raw_quad_iterator ((Triangulation<dim>*)this,
 			    level,
 			    0);
 };
 
 
 
-TriaDimensionInfo<1>::line_iterator
-Triangulation<1>::begin_line (unsigned int level) const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::line_iterator
+Triangulation<dim>::begin_line (unsigned int level) const {
   				   // level is checked in begin_raw
   raw_line_iterator ri = begin_raw_line (level);
   if (ri.state() != valid)
@@ -969,22 +966,18 @@ Triangulation<1>::begin_line (unsigned int level) const {
 
 
 
-TriaDimensionInfo<2>::line_iterator
-Triangulation<2>::begin_line (unsigned int level) const {
-  				   // level is checked in begin_raw
-  raw_line_iterator ri = begin_raw_line (level);
-  if (ri.state() != valid)
-    return ri;
-  while (ri->used() == false)
-    if ((++ri).state() != valid)
-      return ri;
-  return ri;
+
+TriaDimensionInfo<1>::quad_iterator
+Triangulation<1>::begin_quad (unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::quad_iterator
-Triangulation<2>::begin_quad (unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::quad_iterator
+Triangulation<dim>::begin_quad (unsigned int level) const {
   				   // level is checked in begin_raw
   raw_quad_iterator ri = begin_raw_quad (level);
   if (ri.state() != valid)
@@ -997,8 +990,10 @@ Triangulation<2>::begin_quad (unsigned int level) const {
 
 
 
-TriaDimensionInfo<1>::active_line_iterator
-Triangulation<1>::begin_active_line (unsigned int level) const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_line_iterator
+Triangulation<dim>::begin_active_line (unsigned int level) const {
   				   // level is checked in begin_raw
   line_iterator i = begin_line (level);
   if (i.state() != valid)
@@ -1011,22 +1006,17 @@ Triangulation<1>::begin_active_line (unsigned int level) const {
 
 
 
-TriaDimensionInfo<2>::active_line_iterator
-Triangulation<2>::begin_active_line (unsigned int level) const {
-  				   // level is checked in begin_raw
-  line_iterator i = begin_line (level);
-  if (i.state() != valid)
-    return i;
-  while (i->has_children())
-    if ((++i).state() != valid)
-      return i;
-  return i;
+TriaDimensionInfo<1>::active_quad_iterator
+Triangulation<1>::begin_active_quad (unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::active_quad_iterator
-Triangulation<2>::begin_active_quad (unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::active_quad_iterator
+Triangulation<dim>::begin_active_quad (unsigned int level) const {
   				   // level is checked in begin_raw
   quad_iterator i = begin(level);
   if (i.state() != valid)
@@ -1039,92 +1029,99 @@ Triangulation<2>::begin_active_quad (unsigned int level) const {
 
 
 
-TriaDimensionInfo<1>::raw_line_iterator
-Triangulation<1>::end_line () const {
-  return raw_line_iterator ((Triangulation<1>*)this,
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_line_iterator
+Triangulation<dim>::end_line () const {
+  return raw_line_iterator ((Triangulation<dim>*)this,
 			    -1,
 			    -1);
 };
 
 
 
-TriaDimensionInfo<2>::raw_line_iterator
-Triangulation<2>::end_line () const {
-  return raw_line_iterator ((Triangulation<2>*)this,
-			    -1,
-			    -1);
+
+TriaDimensionInfo<1>::raw_quad_iterator
+Triangulation<1>::end_quad () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::raw_quad_iterator
-Triangulation<2>::end_quad () const {
-  return raw_quad_iterator ((Triangulation<2>*)this,
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_quad_iterator
+Triangulation<dim>::end_quad () const {
+  return raw_quad_iterator ((Triangulation<dim>*)this,
 			    -1,
 			    -1);
 };
 
 
 
-TriaDimensionInfo<1>::raw_line_iterator
-Triangulation<1>::last_raw_line (const unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_line_iterator
+Triangulation<dim>::last_raw_line (const unsigned int level) const {
   Assert (level<levels.size(),
 	  ExcInvalidLevel(level));
   
-  return raw_line_iterator ((Triangulation<1>*)this,
+  return raw_line_iterator ((Triangulation<dim>*)this,
 			    level,
 			    levels[level]->lines.lines.size()-1);
 };
 
 
 
-TriaDimensionInfo<2>::raw_line_iterator
-Triangulation<2>::last_raw_line (const unsigned int level) const {
-  Assert (level<levels.size(),
-	  ExcInvalidLevel(level));
-  
-  return raw_line_iterator ((Triangulation<2>*)this,
-			    level,
-			    levels[level]->lines.lines.size()-1);
+
+
+TriaDimensionInfo<1>::raw_quad_iterator
+Triangulation<1>::last_raw_quad (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::raw_quad_iterator
-Triangulation<2>::last_raw_quad (const unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_quad_iterator
+Triangulation<dim>::last_raw_quad (const unsigned int level) const {
   Assert (level<levels.size(),
 	  ExcInvalidLevel(level));
   
-  return raw_quad_iterator ((Triangulation<2>*)this,
+  return raw_quad_iterator ((Triangulation<dim>*)this,
 			    level,
 			    levels[level]->quads.quads.size()-1);
 };
 
 
 
-TriaDimensionInfo<1>::raw_line_iterator
-Triangulation<1>::last_raw_line () const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_line_iterator
+Triangulation<dim>::last_raw_line () const {
   return last_raw_line (levels.size()-1);
 };
 
 
 
-TriaDimensionInfo<2>::raw_line_iterator
-Triangulation<2>::last_raw_line () const {
-  return last_raw_line (levels.size()-1);
+
+TriaDimensionInfo<1>::raw_quad_iterator
+Triangulation<1>::last_raw_quad () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::raw_quad_iterator
-Triangulation<2>::last_raw_quad () const {
+template <int dim>
+typename TriaDimensionInfo<dim>::raw_quad_iterator
+Triangulation<dim>::last_raw_quad () const {
   return last_raw_quad (levels.size()-1);
 };
 
 
 
-TriaDimensionInfo<1>::line_iterator
-Triangulation<1>::last_line (const unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::line_iterator
+Triangulation<dim>::last_line (const unsigned int level) const {
   				   // level is checked in begin_raw
   raw_line_iterator ri = last_raw_line(level);
   if (ri->used()==true)
@@ -1137,22 +1134,18 @@ Triangulation<1>::last_line (const unsigned int level) const {
 
 
 
-TriaDimensionInfo<2>::line_iterator
-Triangulation<2>::last_line (const unsigned int level) const {
-  				   // level is checked in begin_raw
-  raw_line_iterator ri = last_raw_line(level);
-  if (ri->used()==true)
-    return ri;
-  while ((--ri).state() == valid)
-    if (ri->used()==true)
-      return ri;
-  return ri;
+
+TriaDimensionInfo<1>::quad_iterator
+Triangulation<1>::last_quad (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::quad_iterator
-Triangulation<2>::last_quad (const unsigned int level) const {
+template <int dim>
+typename TriaDimensionInfo<dim>::quad_iterator
+Triangulation<dim>::last_quad (const unsigned int level) const {
   				   // level is checked in begin_raw
   raw_quad_iterator ri = last_raw_quad(level);
   if (ri->used()==true)
@@ -1165,29 +1158,35 @@ Triangulation<2>::last_quad (const unsigned int level) const {
 
 
 
-TriaDimensionInfo<1>::line_iterator
-Triangulation<1>::last_line () const {
+template <int dim>
+typename TriaDimensionInfo<dim>::line_iterator
+Triangulation<dim>::last_line () const {
   return last_line (levels.size()-1);
 };
 
 
 
-TriaDimensionInfo<2>::line_iterator
-Triangulation<2>::last_line () const {
-  return last_line (levels.size()-1);
+TriaDimensionInfo<1>::quad_iterator
+Triangulation<1>::last_quad () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::quad_iterator
-Triangulation<2>::last_quad () const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::quad_iterator
+Triangulation<dim>::last_quad () const {
   return last_quad (levels.size()-1);
 };
 
 
 
-TriaDimensionInfo<1>::active_line_iterator
-Triangulation<1>::last_active_line (const unsigned int level) const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_line_iterator
+Triangulation<dim>::last_active_line (const unsigned int level) const {
 				   // level is checked in begin_raw
   line_iterator i = last_line(level);
   if (i->has_children()==false)
@@ -1200,22 +1199,18 @@ Triangulation<1>::last_active_line (const unsigned int level) const {
 
 
 
-TriaDimensionInfo<2>::active_line_iterator
-Triangulation<2>::last_active_line (const unsigned int level) const {
-				   // level is checked in begin_raw
-  line_iterator i = last_line(level);
-  if (i->has_children()==false)
-    return i;
-  while ((--i).state() == valid)
-    if (i->has_children()==false)
-      return i;
-  return i;
+TriaDimensionInfo<1>::active_quad_iterator
+Triangulation<1>::last_active_quad (const unsigned int) const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::active_quad_iterator
-Triangulation<2>::last_active_quad (const unsigned int level) const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_quad_iterator
+Triangulation<dim>::last_active_quad (const unsigned int level) const {
 				   // level is checked in begin_raw
   quad_iterator i = last_quad(level);
   if (i->has_children()==false)
@@ -1229,22 +1224,26 @@ Triangulation<2>::last_active_quad (const unsigned int level) const {
 
 
 
-TriaDimensionInfo<1>::active_line_iterator
-Triangulation<1>::last_active_line () const {
+template <int dim>
+typename TriaDimensionInfo<dim>::active_line_iterator
+Triangulation<dim>::last_active_line () const {
   return last_active_line (levels.size()-1);
 };
 
 
 
-TriaDimensionInfo<2>::active_line_iterator
-Triangulation<2>::last_active_line () const {
-  return last_active_line (levels.size()-1);
+TriaDimensionInfo<1>::active_quad_iterator
+Triangulation<1>::last_active_quad () const {
+  Assert (false, ExcFunctionNotUseful());
+  return 0;
 };
 
 
 
-TriaDimensionInfo<2>::active_quad_iterator
-Triangulation<2>::last_active_quad () const {
+
+template <int dim>
+typename TriaDimensionInfo<dim>::active_quad_iterator
+Triangulation<dim>::last_active_quad () const {
   return last_active_quad (levels.size()-1);
 };
 
diff --git a/deal.II/deal.II/source/numerics/assembler.cc b/deal.II/deal.II/source/numerics/assembler.cc
index f425dc6606..44f76cedad 100644
--- a/deal.II/deal.II/source/numerics/assembler.cc
+++ b/deal.II/deal.II/source/numerics/assembler.cc
@@ -15,51 +15,29 @@ Equation<dim>::Equation (const unsigned int n_equations) :
 
 
 
-void Equation<1>::assemble (dFMatrix          &,
-			    dVector           &,
-			    const FEValues<1> &,
-			    const Triangulation<1>::cell_iterator &) const {
-  Assert (false, ExcPureVirtualFunctionCalled());
-};
-
-
-
-void Equation<2>::assemble (dFMatrix          &,
-			    dVector           &,
-			    const FEValues<2> &,
-			    const Triangulation<2>::cell_iterator &) const {
-  Assert (false, ExcPureVirtualFunctionCalled());
-};
-
-
-
-void Equation<1>::assemble (dFMatrix          &,
-			    const FEValues<1> &,
-			    const Triangulation<1>::cell_iterator &) const {
-  Assert (false, ExcPureVirtualFunctionCalled());
-};
-
-
-
-void Equation<2>::assemble (dFMatrix          &,
-			    const FEValues<2> &,
-			    const Triangulation<2>::cell_iterator &) const {
+template <int dim>
+void Equation<dim>::assemble (dFMatrix          &,
+			      dVector           &,
+			      const FEValues<dim> &,
+			      const typename Triangulation<dim>::cell_iterator &) const {
   Assert (false, ExcPureVirtualFunctionCalled());
 };
 
 
 
-void Equation<1>::assemble (dVector           &,
-			    const FEValues<1> &,
-			    const Triangulation<1>::cell_iterator &) const {
+template <int dim>
+void Equation<dim>::assemble (dFMatrix          &,
+			      const FEValues<dim> &,
+			      const typename Triangulation<dim>::cell_iterator &) const {
   Assert (false, ExcPureVirtualFunctionCalled());
 };
 
 
 
-void Equation<2>::assemble (dVector           &,
-			    const FEValues<2> &,
-			    const Triangulation<2>::cell_iterator &) const {
+template <int dim>
+void Equation<dim>::assemble (dVector           &,
+			      const FEValues<dim> &,
+			      const typename Triangulation<dim>::cell_iterator &) const {
   Assert (false, ExcPureVirtualFunctionCalled());
 };
 
diff --git a/tests/big-tests/Makefile b/tests/big-tests/Makefile
index 5825f83c2e..7ecbf0cb94 100644
--- a/tests/big-tests/Makefile
+++ b/tests/big-tests/Makefile
@@ -36,7 +36,7 @@ examples: $(cc-files:.cc=)
 
 grid/grid_test: grid/grid_test.o $(LIBFILES)
 	@echo ================= Linking $@
-	@$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS)
+	@$(CXX) $(CXXFLAGS) -o $@ $< $(LIBS.g)
 
 dof/dof_test: dof/dof_test.o $(LIBFILES.g)
 	@echo ================= Linking $@
-- 
2.39.5