diff --git a/dune/mmdg/eigenvaluehelper.hh b/dune/mmdg/eigenvaluehelper.hh index 63bde0fdbac7fd10c587c741c768be6247d42d66..a3e9cf0110cf2db8cb68bd30bea57c92d60f4a14 100644 --- a/dune/mmdg/eigenvaluehelper.hh +++ b/dune/mmdg/eigenvaluehelper.hh @@ -36,6 +36,13 @@ public: static void eigenValues(const Dune::FieldMatrix<K, 2, 2>& matrix, Dune::FieldVector<K, 2>& eigenvalues) { + if ( std::abs(matrix[1][0]) < 1e-15 && std::abs(matrix[0][1]) < 1e-15 ) + { //diagonal matrix + eigenvalues[0] = std::min(matrix[0][0], matrix[1][1]); + eigenvalues[1] = std::max(matrix[0][0], matrix[1][1]); + return; + } + using std::sqrt; const K detM = matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1]; const K p = 0.5 * (matrix[0][0] + matrix [1][1]);