From 468f9bd301fff665b407359344e472ea8f454472 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 16 Jul 2009 23:01:34 +0000 Subject: [PATCH] Make a function a bit more abstract by doing away with concrete template parameters and deducing them from other template arguments. git-svn-id: https://svn.dealii.org/trunk@19103 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/grid_tools.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/source/grid/grid_tools.cc b/deal.II/deal.II/source/grid/grid_tools.cc index b43ced022a..c69e9145c7 100644 --- a/deal.II/deal.II/source/grid/grid_tools.cc +++ b/deal.II/deal.II/source/grid/grid_tools.cc @@ -1243,11 +1243,15 @@ namespace internal { namespace FixUpDistortedChildCells { - template + template double - objective_function (const typename dealii::Triangulation::cell_iterator &cell, + objective_function (const Iterator &cell, const Point &cell_mid_point) { + const unsigned int dim = Iterator::AccessorType::structure_dimension; + Assert (spacedim == Iterator::AccessorType::dimension, + ExcInternalError()); + // everything below is wrong // if not for the following // condition @@ -1371,18 +1375,16 @@ namespace internal // compute the objective // function and its derivative - const double val = objective_function (cell, cell_mid_point); + const double val = objective_function (cell, cell_mid_point); Tensor<1,dim> gradient; for (unsigned int d=0; d h; h[d] = step_length/2; - gradient[d] = (objective_function (cell, - cell_mid_point + h) + gradient[d] = (objective_function (cell, cell_mid_point + h) - - objective_function (cell, - cell_mid_point - h)) + objective_function (cell, cell_mid_point - h)) / step_length; } -- 2.39.5