From: Wolfgang Bangerth Date: Thu, 16 Jul 2009 23:01:34 +0000 (+0000) Subject: Make a function a bit more abstract by doing away with concrete X-Git-Tag: v8.0.0~7459 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=468f9bd301fff665b407359344e472ea8f454472;p=dealii.git 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 --- 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; }