Skip to content
Snippets Groups Projects
Commit 445166cf authored by Max Kahnt's avatar Max Kahnt
Browse files

Use consistent ordering of (template) types and variables.

parent 24803525
Branches
No related tags found
No related merge requests found
...@@ -14,9 +14,9 @@ namespace MatrixVector { ...@@ -14,9 +14,9 @@ namespace MatrixVector {
// add transformed matrix A += T1^t*B*T2 // add transformed matrix A += T1^t*B*T2
// ****************************************************** // ******************************************************
template <class MatrixA, class MatrixB, class TransformationMatrix1, template <class MatrixA, class TransformationMatrix1, class MatrixB,
class TransformationMatrix2, bool AisScalar, bool BisScalar, class TransformationMatrix2, bool AisScalar, bool T1isScalar,
bool T1isScalar, bool T2isScalar> bool BisScalar, bool T2isScalar>
struct TransformMatrixHelper { struct TransformMatrixHelper {
static void addTransformedMatrix(MatrixA& A, static void addTransformedMatrix(MatrixA& A,
const TransformationMatrix1& T1, const TransformationMatrix1& T1,
...@@ -73,8 +73,8 @@ namespace MatrixVector { ...@@ -73,8 +73,8 @@ namespace MatrixVector {
template <class K1, class K2, class K3, int n, int m> template <class K1, class K2, class K3, int n, int m>
struct TransformMatrixHelper< struct TransformMatrixHelper<
Dune::FieldMatrix<K1, m, m>, Dune::FieldMatrix<K3, n, n>, Dune::FieldMatrix<K1, m, m>, Dune::FieldMatrix<K2, n, m>,
Dune::FieldMatrix<K2, n, m>, Dune::FieldMatrix<K2, n, m>, false, false, Dune::FieldMatrix<K3, n, n>, Dune::FieldMatrix<K2, n, m>, false, false,
false, false> { false, false> {
typedef Dune::FieldMatrix<K1, m, m> MatrixA; typedef Dune::FieldMatrix<K1, m, m> MatrixA;
typedef Dune::FieldMatrix<K3, n, n> MatrixB; typedef Dune::FieldMatrix<K3, n, n> MatrixB;
...@@ -114,10 +114,10 @@ namespace MatrixVector { ...@@ -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> class ScalarTransform2, bool AisScalar, bool BisScalar>
struct TransformMatrixHelper<MatrixA, MatrixB, ScalarTransform1, struct TransformMatrixHelper<MatrixA, ScalarTransform1, MatrixB,
ScalarTransform2, AisScalar, BisScalar, true, ScalarTransform2, AisScalar, true, BisScalar,
true> { true> {
static void addTransformedMatrix(MatrixA& A, const ScalarTransform1& T1, static void addTransformedMatrix(MatrixA& A, const ScalarTransform1& T1,
const MatrixB& B, const MatrixB& B,
...@@ -126,12 +126,12 @@ namespace MatrixVector { ...@@ -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, class TransformationMatrix2, bool AisScalar, bool T1isScalar,
bool T2isScalar> bool T2isScalar>
struct TransformMatrixHelper<MatrixA, ScalarB, TransformationMatrix1, struct TransformMatrixHelper<MatrixA, TransformationMatrix1, ScalarB,
TransformationMatrix2, AisScalar, true, TransformationMatrix2, AisScalar, T1isScalar,
T1isScalar, T2isScalar> { true, T2isScalar> {
static void addTransformedMatrix(MatrixA& A, static void addTransformedMatrix(MatrixA& A,
const TransformationMatrix1& T1, const TransformationMatrix1& T1,
const ScalarB& B, const ScalarB& B,
...@@ -147,27 +147,27 @@ namespace MatrixVector { ...@@ -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, class TransformationMatrix2, bool AisScalar, bool T1isScalar,
bool T2isScalar> bool T2isScalar>
struct TransformMatrixHelper< struct TransformMatrixHelper<
Dune::ScaledIdentityMatrix<FieldType, n>, ScalarB, TransformationMatrix1, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1, ScalarB,
TransformationMatrix2, AisScalar, true, T1isScalar, T2isScalar> { TransformationMatrix2, AisScalar, T1isScalar, true, T2isScalar> {
typedef Dune::ScaledIdentityMatrix<FieldType, n> MatrixA; typedef Dune::ScaledIdentityMatrix<FieldType, n> MatrixA;
static void addTransformedMatrix(MatrixA& A, static void addTransformedMatrix(MatrixA& A,
const TransformationMatrix1& T1, const TransformationMatrix1& T1,
const ScalarB& B, const ScalarB& B,
const TransformationMatrix2& T2) { const TransformationMatrix2& T2) {
TransformMatrixHelper< TransformMatrixHelper<
FieldType, ScalarB, typename TransformationMatrix1::field_type, FieldType, typename TransformationMatrix1::field_type, ScalarB,
typename TransformationMatrix2::field_type, true, true, true, typename TransformationMatrix2::field_type, true, true, true,
true>::addTransformedMatrix(A.scalar(), T1.scalar(), B, T2.scalar()); 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> class ScalarTransform2>
struct TransformMatrixHelper<ScalarA, ScalarB, ScalarTransform1, struct TransformMatrixHelper<ScalarA, ScalarTransform1, ScalarB,
ScalarTransform2, true, true, true, true> { ScalarTransform2, true, true, true, true> {
static void addTransformedMatrix(ScalarA& A, const ScalarTransform1& T1, static void addTransformedMatrix(ScalarA& A, const ScalarTransform1& T1,
const ScalarB& B, const ScalarB& B,
...@@ -176,11 +176,11 @@ namespace MatrixVector { ...@@ -176,11 +176,11 @@ namespace MatrixVector {
} }
}; };
template <class MatrixA, typename FieldType, int n, template <class MatrixA, class TransformationMatrix1, typename FieldType,
class TransformationMatrix1, class TransformationMatrix2> int n, class TransformationMatrix2>
struct TransformMatrixHelper<MatrixA, Dune::DiagonalMatrix<FieldType, n>, struct TransformMatrixHelper<
TransformationMatrix1, TransformationMatrix2, MatrixA, TransformationMatrix1, Dune::DiagonalMatrix<FieldType, n>,
false, false, false, false> { TransformationMatrix2, false, false, false, false> {
static void addTransformedMatrix( static void addTransformedMatrix(
MatrixA& A, const TransformationMatrix1& T1, MatrixA& A, const TransformationMatrix1& T1,
const Dune::DiagonalMatrix<FieldType, n>& B, const Dune::DiagonalMatrix<FieldType, n>& B,
...@@ -196,27 +196,27 @@ namespace MatrixVector { ...@@ -196,27 +196,27 @@ namespace MatrixVector {
} }
}; };
template <class MatrixA, typename FieldType, int n, template <class MatrixA, class TransformationMatrix1, typename FieldType,
class TransformationMatrix1, class TransformationMatrix2> int n, class TransformationMatrix2>
struct TransformMatrixHelper< struct TransformMatrixHelper<
MatrixA, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1, MatrixA, TransformationMatrix1, Dune::ScaledIdentityMatrix<FieldType, n>,
TransformationMatrix2, false, false, false, false> { TransformationMatrix2, false, false, false, false> {
static void addTransformedMatrix( static void addTransformedMatrix(
MatrixA& A, const TransformationMatrix1& T1, MatrixA& A, const TransformationMatrix1& T1,
const Dune::ScaledIdentityMatrix<FieldType, n>& B, const Dune::ScaledIdentityMatrix<FieldType, n>& B,
const TransformationMatrix2& T2) { const TransformationMatrix2& T2) {
TransformMatrixHelper<MatrixA, FieldType, TransformationMatrix1, TransformMatrixHelper<MatrixA, TransformationMatrix1, FieldType,
TransformationMatrix2, false, true, false, TransformationMatrix2, false, false, true,
false>::addTransformedMatrix(A, T1, B.scalar(), T2); false>::addTransformedMatrix(A, T1, B.scalar(), T2);
} }
}; };
template <typename FieldType, int n, class TransformationMatrix1, template <typename FieldType, int n, class TransformationMatrix1,
class TransformationMatrix2> class TransformationMatrix2>
struct TransformMatrixHelper<Dune::DiagonalMatrix<FieldType, n>, struct TransformMatrixHelper<
Dune::DiagonalMatrix<FieldType, n>, Dune::DiagonalMatrix<FieldType, n>, TransformationMatrix1,
TransformationMatrix1, TransformationMatrix2, Dune::DiagonalMatrix<FieldType, n>, TransformationMatrix2, false, false,
false, false, false, false> { false, false> {
static void addTransformedMatrix( static void addTransformedMatrix(
Dune::DiagonalMatrix<FieldType, n>& A, const TransformationMatrix1& T1, Dune::DiagonalMatrix<FieldType, n>& A, const TransformationMatrix1& T1,
const Dune::DiagonalMatrix<FieldType, n>& B, const Dune::DiagonalMatrix<FieldType, n>& B,
...@@ -231,10 +231,10 @@ namespace MatrixVector { ...@@ -231,10 +231,10 @@ namespace MatrixVector {
template <typename FieldType, int n, class TransformationMatrix1, template <typename FieldType, int n, class TransformationMatrix1,
class TransformationMatrix2> class TransformationMatrix2>
struct TransformMatrixHelper<Dune::ScaledIdentityMatrix<FieldType, n>, struct TransformMatrixHelper<
Dune::ScaledIdentityMatrix<FieldType, n>, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix1,
TransformationMatrix1, TransformationMatrix2, Dune::ScaledIdentityMatrix<FieldType, n>, TransformationMatrix2, false,
false, false, false, false> { false, false, false> {
static void addTransformedMatrix( static void addTransformedMatrix(
Dune::ScaledIdentityMatrix<FieldType, n>& A, Dune::ScaledIdentityMatrix<FieldType, n>& A,
const TransformationMatrix1& T1, const TransformationMatrix1& T1,
...@@ -263,34 +263,36 @@ namespace MatrixVector { ...@@ -263,34 +263,36 @@ namespace MatrixVector {
} }
}; };
template <class MatrixA, class MatrixB, class TransformationMatrix1, template <class MatrixA, class TransformationMatrix1, class MatrixB,
class TransformationMatrix2> class TransformationMatrix2>
void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1, void addTransformedMatrix(MatrixA& A, const TransformationMatrix1& T1,
const MatrixB& B, const TransformationMatrix2& T2) { const MatrixB& B, const TransformationMatrix2& T2) {
TransformMatrixHelper< TransformMatrixHelper<
MatrixA, MatrixB, TransformationMatrix1, TransformationMatrix2, MatrixA, TransformationMatrix1, MatrixB, TransformationMatrix2,
ScalarTraits<MatrixA>::isScalar, ScalarTraits<MatrixB>::isScalar, ScalarTraits<MatrixA>::isScalar,
ScalarTraits<TransformationMatrix1>::isScalar, ScalarTraits<TransformationMatrix1>::isScalar,
ScalarTraits<MatrixB>::isScalar,
ScalarTraits< ScalarTraits<
TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B, TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B,
T2); T2);
} }
template <class MatrixA, class MatrixB, class TransformationMatrix1, template <class MatrixA, class TransformationMatrix1, class MatrixB,
class TransformationMatrix2> class TransformationMatrix2>
void transformMatrix(MatrixA& A, const TransformationMatrix1& T1, void transformMatrix(MatrixA& A, const TransformationMatrix1& T1,
const MatrixB& B, const TransformationMatrix2& T2) { const MatrixB& B, const TransformationMatrix2& T2) {
A = 0; A = 0;
TransformMatrixHelper< TransformMatrixHelper<
MatrixA, MatrixB, TransformationMatrix1, TransformationMatrix2, MatrixA, TransformationMatrix1, MatrixB, TransformationMatrix2,
ScalarTraits<MatrixA>::isScalar, ScalarTraits<MatrixB>::isScalar, ScalarTraits<MatrixA>::isScalar,
ScalarTraits<TransformationMatrix1>::isScalar, ScalarTraits<TransformationMatrix1>::isScalar,
ScalarTraits<MatrixB>::isScalar,
ScalarTraits< ScalarTraits<
TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B, TransformationMatrix2>::isScalar>::addTransformedMatrix(A, T1, B,
T2); T2);
} }
template <class MatrixBlockA, class MatrixB, class TransformationMatrix1, template <class MatrixBlockA, class TransformationMatrix1, class MatrixB,
class TransformationMatrix2> class TransformationMatrix2>
static void transformMatrix(Dune::BCRSMatrix<MatrixBlockA>& A, static void transformMatrix(Dune::BCRSMatrix<MatrixBlockA>& A,
const TransformationMatrix1& T1, const MatrixB& B, const TransformationMatrix1& T1, const MatrixB& B,
...@@ -313,7 +315,7 @@ namespace MatrixVector { ...@@ -313,7 +315,7 @@ namespace MatrixVector {
} }
} }
template <class MatrixBlockA, class MatrixB, class TransformationMatrix1, template <class MatrixBlockA, class TransformationMatrix1, class MatrixB,
class TransformationMatrix2> class TransformationMatrix2>
static void transformMatrixPattern(Dune::BCRSMatrix<MatrixBlockA>& A, static void transformMatrixPattern(Dune::BCRSMatrix<MatrixBlockA>& A,
const TransformationMatrix1& T1, const TransformationMatrix1& T1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment