From: David Wells Date: Wed, 7 Aug 2019 15:36:26 +0000 (-0600) Subject: Remove duplicated code. X-Git-Tag: v9.2.0-rc1~1305^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8481%2Fhead;p=dealii.git Remove duplicated code. The exact same code is in the GridTools function. --- diff --git a/source/grid/tria_accessor.cc b/source/grid/tria_accessor.cc index 8f2e1b3155..06321aebf5 100644 --- a/source/grid/tria_accessor.cc +++ b/source/grid/tria_accessor.cc @@ -1264,52 +1264,12 @@ namespace double measure(const TriaAccessor<2, 2, 2> &accessor) { - // the evaluation of the formulae - // is a bit tricky when done dimension - // independently, so we write this function - // for 2D and 3D separately - /* - Get the computation of the measure by this little Maple script. We - use the blinear mapping of the unit quad to the real quad. However, - every transformation mapping the unit faces to straight lines should - do. - - Remember that the area of the quad is given by - \int_K 1 dx dy = \int_{\hat K} |det J| d(xi) d(eta) - - # x and y are arrays holding the x- and y-values of the four vertices - # of this cell in real space. - x := array(0..3); - y := array(0..3); - tphi[0] := (1-xi)*(1-eta): - tphi[1] := xi*(1-eta): - tphi[2] := (1-xi)*eta: - tphi[3] := xi*eta: - x_real := sum(x[s]*tphi[s], s=0..3): - y_real := sum(y[s]*tphi[s], s=0..3): - detJ := diff(x_real,xi)*diff(y_real,eta) - - diff(x_real,eta)*diff(y_real,xi): - - measure := simplify ( int ( int (detJ, xi=0..1), eta=0..1)): - readlib(C): - - C(measure, optimized); - - additional optimizaton: divide by 2 only one time - */ - - const double x[4] = {accessor.vertex(0)(0), - accessor.vertex(1)(0), - accessor.vertex(2)(0), - accessor.vertex(3)(0)}; - const double y[4] = {accessor.vertex(0)(1), - accessor.vertex(1)(1), - accessor.vertex(2)(1), - accessor.vertex(3)(1)}; + unsigned int vertex_indices[GeometryInfo<2>::vertices_per_cell]; + for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i) + vertex_indices[i] = accessor.vertex_index(i); - return (-x[1] * y[0] + x[1] * y[3] + y[0] * x[2] + x[0] * y[1] - - x[0] * y[2] - y[1] * x[3] - x[2] * y[3] + x[3] * y[2]) / - 2; + return GridTools::cell_measure<2>( + accessor.get_triangulation().get_vertices(), vertex_indices); }