From b4d4737e1617d5ddb44aa60eb866a5031e6f0898 Mon Sep 17 00:00:00 2001 From: Lukas Riedel Date: Tue, 31 Jul 2018 20:14:33 +0200 Subject: [PATCH] Merge branch '80-estimate-of-matrix-backend-entry-numbers-is-wrong' into 'master' Resolve "Estimate of matrix backend entry numbers is wrong" See merge request !75 Closes #80 (cherry picked from commit 31f02865cdd6bef19fd8d824139fd4f378ae2942) --- dune/dorie/interface/util.hh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/dune/dorie/interface/util.hh b/dune/dorie/interface/util.hh index 5bd1da6a..5eb85098 100644 --- a/dune/dorie/interface/util.hh +++ b/dune/dorie/interface/util.hh @@ -19,28 +19,22 @@ namespace Dune{ namespace Dorie{ -/// Return the estimation of entries per matrix row for the spatial GridOperator. +/// Return the estimation of entries per matrix row for the spatial GridOperator /** This supposedly decreases matrix assembly time. - * The values are empirical. The actual matrix statistics can be displayed - * by assembling the IGO Jacobian and calling patternStatistics(). + * The values specify the *blocks* per row. DG assembles one block for the + * actual element and one for each of its neighbors. * \param dim Spatial dimension * \param geo Geometry type of grid entities - * \return Estimated entries per matrix row + * \return Estimated number of blocks per matrix row */ template -R estimate_mbe_entries (const int dim, const Dune::GeometryType::BasicType geo) +constexpr R estimate_mbe_entries (const int dim, const Dune::GeometryType::BasicType geo) { - if(geo==Dune::GeometryType::BasicType::cube){ - if(dim==2) - return 5; - else if(dim==3) - return 7; + if (geo==Dune::GeometryType::BasicType::cube){ + return 2*dim + 1; } - else if(geo==Dune::GeometryType::BasicType::simplex){ - if(dim==2) - return 13; - else if(dim==3) - return 20; + else if (geo==Dune::GeometryType::BasicType::simplex){ + return dim + 2; } std::cerr << "Cannot provide MBE entry estimation for given dimension and/or GeometryType!" << std::endl; return 1; -- 2.22.0