diff --git a/dune/matrix-vector/transformmatrix.hh b/dune/matrix-vector/transformmatrix.hh index e2679ae441ff81327b56bbe8b79c42de6b66b8fd..ee851397d334ef3cf692e3f21a31175b85490320 100644 --- a/dune/matrix-vector/transformmatrix.hh +++ b/dune/matrix-vector/transformmatrix.hh @@ -14,9 +14,9 @@ namespace MatrixVector { // add transformed matrix A += T1^t*B*T2 // ****************************************************** - template <class MatrixA, class MatrixB, class TransformationMatrix1, - class TransformationMatrix2, bool AisScalar, bool BisScalar, - bool T1isScalar, bool T2isScalar> + template <class MatrixA, class TransformationMatrix1, class MatrixB, + class TransformationMatrix2, bool AisScalar, bool T1isScalar, + bool BisScalar, bool T2isScalar> struct TransformMatrixHelper { static void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1, @@ -73,8 +73,8 @@ namespace MatrixVector { template <class K1, class K2, class K3, int n, int m> struct TransformMatrixHelper< - Dune::FieldMatrix<K1, m, m>, Dune::FieldMatrix<K3, n, n>, - Dune::FieldMatrix<K2, n, m>, Dune::FieldMatrix<K2, n, m>, false, false, + Dune::FieldMatrix<K1, m, m>, Dune::FieldMatrix<K2, n, m>, + Dune::FieldMatrix<K3, n, n>, Dune::FieldMatrix<K2, n, m>, false, false, false, false> { typedef Dune::FieldMatrix<K1, m, m> MatrixA; typedef Dune::FieldMatrix<K3, n, n> MatrixB; @@ -114,10 +114,10 @@ namespace MatrixVector { // } }; - template <class MatrixA, class MatrixB, class ScalarTransform1, + template <class MatrixA, class ScalarTransform1, class MatrixB, class ScalarTransform2, bool AisScalar, bool BisScalar> - struct TransformMatrixHelper<MatrixA, MatrixB, ScalarTransform1, - ScalarTransform2, AisScalar, BisScalar, true, + struct TransformMatrixHelper<MatrixA, ScalarTransform1, MatrixB, + ScalarTransform2, AisScalar, true, BisScalar, true> { static void addTransformedMatrix(MatrixA& A, const ScalarTransform1& T1, const MatrixB& B, @@ -126,12 +126,12 @@ namespace MatrixVector { } }; - template <class MatrixA, class ScalarB, class TransformationMatrix1, + template <class MatrixA, class TransformationMatrix1, class ScalarB, class TransformationMatrix2, bool AisScalar, bool T1isScalar, bool T2isScalar> - struct TransformMatrixHelper<MatrixA, ScalarB, TransformationMatrix1, - TransformationMatrix2, AisScalar, true, - T1isScalar, T2isScalar> { + struct TransformMatrixHelper<MatrixA, TransformationMatrix1, ScalarB, + TransformationMatrix2, AisScalar, T1isScalar, + true, T2isScalar> { static void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1, const ScalarB& B, @@ -147,27 +147,27 @@ namespace MatrixVector { } }; - template <class FieldType, int n, class ScalarB, class TransformationMatrix1, + template <class FieldType, int n, class TransformationMatrix1, class ScalarB, class TransformationMatrix2, bool AisScalar, bool T1isScalar, bool T2isScalar> struct TransformMatrixHelper< - Dune::ScaledIdentityMatrix<FieldType, n>, ScalarB, TransformationMatrix1, - TransformationMatrix2, AisScalar, true, T1isScalar, T2isScalar> { + Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1, ScalarB, + TransformationMatrix2, AisScalar, T1isScalar, true, T2isScalar> { typedef Dune::ScaledIdentityMatrix<FieldType, n> MatrixA; static void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1, const ScalarB& B, const TransformationMatrix2& T2) { TransformMatrixHelper< - FieldType, ScalarB, typename TransformationMatrix1::field_type, + FieldType, typename TransformationMatrix1::field_type, ScalarB, typename TransformationMatrix2::field_type, true, true, true, true>::addTransformedMatrix(A.scalar(), T1.scalar(), B, T2.scalar()); } }; - template <class ScalarA, class ScalarB, class ScalarTransform1, + template <class ScalarA, class ScalarTransform1, class ScalarB, class ScalarTransform2> - struct TransformMatrixHelper<ScalarA, ScalarB, ScalarTransform1, + struct TransformMatrixHelper<ScalarA, ScalarTransform1, ScalarB, ScalarTransform2, true, true, true, true> { static void addTransformedMatrix(ScalarA& A, const ScalarTransform1& T1, const ScalarB& B, @@ -176,11 +176,11 @@ namespace MatrixVector { } }; - template <class MatrixA, typename FieldType, int n, - class TransformationMatrix1, class TransformationMatrix2> - struct TransformMatrixHelper<MatrixA, Dune::DiagonalMatrix<FieldType, n>, - TransformationMatrix1, TransformationMatrix2, - false, false, false, false> { + template <class MatrixA, class TransformationMatrix1, typename FieldType, + int n, class TransformationMatrix2> + struct TransformMatrixHelper< + MatrixA, TransformationMatrix1, Dune::DiagonalMatrix<FieldType, n>, + TransformationMatrix2, false, false, false, false> { static void addTransformedMatrix( MatrixA& A, const TransformationMatrix1& T1, const Dune::DiagonalMatrix<FieldType, n>& B, @@ -196,27 +196,27 @@ namespace MatrixVector { } }; - template <class MatrixA, typename FieldType, int n, - class TransformationMatrix1, class TransformationMatrix2> + template <class MatrixA, class TransformationMatrix1, typename FieldType, + int n, class TransformationMatrix2> struct TransformMatrixHelper< - MatrixA, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1, + MatrixA, TransformationMatrix1, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix2, false, false, false, false> { static void addTransformedMatrix( MatrixA& A, const TransformationMatrix1& T1, const Dune::ScaledIdentityMatrix<FieldType, n>& B, const TransformationMatrix2& T2) { - TransformMatrixHelper<MatrixA, FieldType, TransformationMatrix1, - TransformationMatrix2, false, true, false, + TransformMatrixHelper<MatrixA, TransformationMatrix1, FieldType, + TransformationMatrix2, false, false, true, false>::addTransformedMatrix(A, T1, B.scalar(), T2); } }; template <typename FieldType, int n, class TransformationMatrix1, class TransformationMatrix2> - struct TransformMatrixHelper<Dune::DiagonalMatrix<FieldType, n>, - Dune::DiagonalMatrix<FieldType, n>, - TransformationMatrix1, TransformationMatrix2, - false, false, false, false> { + struct TransformMatrixHelper< + Dune::DiagonalMatrix<FieldType, n>, TransformationMatrix1, + Dune::DiagonalMatrix<FieldType, n>, TransformationMatrix2, false, false, + false, false> { static void addTransformedMatrix( Dune::DiagonalMatrix<FieldType, n>& A, const TransformationMatrix1& T1, const Dune::DiagonalMatrix<FieldType, n>& B, @@ -231,10 +231,10 @@ namespace MatrixVector { template <typename FieldType, int n, class TransformationMatrix1, class TransformationMatrix2> - struct TransformMatrixHelper<Dune::ScaledIdentityMatrix<FieldType, n>, - Dune::ScaledIdentityMatrix<FieldType, n>, - TransformationMatrix1, TransformationMatrix2, - false, false, false, false> { + struct TransformMatrixHelper< + Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1, + Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix2, false, + false, false, false> { static void addTransformedMatrix( Dune::ScaledIdentityMatrix<FieldType, n>& A, const TransformationMatrix1& T1, @@ -263,34 +263,36 @@ namespace MatrixVector { } }; - template <class MatrixA, class MatrixB, class TransformationMatrix1, + template <class MatrixA, class TransformationMatrix1, class MatrixB, class TransformationMatrix2> void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1, const MatrixB& B, const TransformationMatrix2& T2) { TransformMatrixHelper< - MatrixA, MatrixB, TransformationMatrix1, TransformationMatrix2, - ScalarTraits<MatrixA>::isScalar, ScalarTraits<MatrixB>::isScalar, + MatrixA, TransformationMatrix1, MatrixB, TransformationMatrix2, + ScalarTraits<MatrixA>::isScalar, ScalarTraits<TransformationMatrix1>::isScalar, + ScalarTraits<MatrixB>::isScalar, ScalarTraits< TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B, T2); } - template <class MatrixA, class MatrixB, class TransformationMatrix1, + template <class MatrixA, class TransformationMatrix1, class MatrixB, class TransformationMatrix2> void transformMatrix(MatrixA& A, const TransformationMatrix1& T1, const MatrixB& B, const TransformationMatrix2& T2) { A = 0; TransformMatrixHelper< - MatrixA, MatrixB, TransformationMatrix1, TransformationMatrix2, - ScalarTraits<MatrixA>::isScalar, ScalarTraits<MatrixB>::isScalar, + MatrixA, TransformationMatrix1, MatrixB, TransformationMatrix2, + ScalarTraits<MatrixA>::isScalar, ScalarTraits<TransformationMatrix1>::isScalar, + ScalarTraits<MatrixB>::isScalar, ScalarTraits< TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B, T2); } - template <class MatrixBlockA, class MatrixB, class TransformationMatrix1, + template <class MatrixBlockA, class TransformationMatrix1, class MatrixB, class TransformationMatrix2> static void transformMatrix(Dune::BCRSMatrix<MatrixBlockA>& A, const TransformationMatrix1& T1, const MatrixB& B, @@ -313,7 +315,7 @@ namespace MatrixVector { } } - template <class MatrixBlockA, class MatrixB, class TransformationMatrix1, + template <class MatrixBlockA, class TransformationMatrix1, class MatrixB, class TransformationMatrix2> static void transformMatrixPattern(Dune::BCRSMatrix<MatrixBlockA>& A, const TransformationMatrix1& T1,