Commit b4d4737e authored by Lukas Riedel's avatar Lukas Riedel

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 31f02865)
parent c068e256
...@@ -19,28 +19,22 @@ ...@@ -19,28 +19,22 @@
namespace Dune{ namespace Dune{
namespace Dorie{ 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. /** This supposedly decreases matrix assembly time.
* The values are empirical. The actual matrix statistics can be displayed * The values specify the *blocks* per row. DG assembles one block for the
* by assembling the IGO Jacobian and calling patternStatistics(). * actual element and one for each of its neighbors.
* \param dim Spatial dimension * \param dim Spatial dimension
* \param geo Geometry type of grid entities * \param geo Geometry type of grid entities
* \return Estimated entries per matrix row * \return Estimated number of blocks per matrix row
*/ */
template<typename R = std::size_t> template<typename R = std::size_t>
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 (geo==Dune::GeometryType::BasicType::cube){
if(dim==2) return 2*dim + 1;
return 5;
else if(dim==3)
return 7;
} }
else if(geo==Dune::GeometryType::BasicType::simplex){ else if (geo==Dune::GeometryType::BasicType::simplex){
if(dim==2) return dim + 2;
return 13;
else if(dim==3)
return 20;
} }
std::cerr << "Cannot provide MBE entry estimation for given dimension and/or GeometryType!" << std::endl; std::cerr << "Cannot provide MBE entry estimation for given dimension and/or GeometryType!" << std::endl;
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment