diff --git a/dumux/nonlinear/staggerednewtoncontroller.hh b/dumux/nonlinear/staggerednewtoncontroller.hh index f1bc8f0789c0c7d5df01c4f2b57d171970b2f87f..d7cf5919c840b54a694fa4c82bac7ae9e13fd1a2 100644 --- a/dumux/nonlinear/staggerednewtoncontroller.hh +++ b/dumux/nonlinear/staggerednewtoncontroller.hh @@ -268,6 +268,26 @@ private: return converged; } + //! helper method to assure the MultiType matrix's sub blocks have the correct sizes + template<class JacobianMatrix> + bool checkMatrix_(const JacobianMatrix& A) + { + bool matrixHasCorrectSize = true; + using namespace Dune::Hybrid; + using namespace Dune::Indices; + forEach(A, [&matrixHasCorrectSize](const auto& rowOfMultiTypeMatrix) + { + const auto numRowsLeftMostBlock = rowOfMultiTypeMatrix[_0].N(); + + forEach(rowOfMultiTypeMatrix, [&matrixHasCorrectSize, &numRowsLeftMostBlock](const auto& subBlock) + { + if (subBlock.N() != numRowsLeftMostBlock) + matrixHasCorrectSize = false; + }); + }); + return matrixHasCorrectSize; + } + }; } // end namespace Dumux