version 3.10-dev
linearalgebratraits.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_LINEAR_ALGEBRA_TRAITS_HH
13#define DUMUX_LINEAR_ALGEBRA_TRAITS_HH
14
15#include <utility>
16#include <type_traits>
17
20
22
23template<class Assembler, bool isMultiType = false>
25{
26 using Vector = typename Assembler::ResidualType;
27 using Matrix = typename Assembler::JacobianMatrix;
30};
31
32template<class Assembler>
33struct LATraitsFromAssemblerImpl<Assembler, true>
34{
35 using Vector = typename Assembler::ResidualType;
36 using Matrix = typename Assembler::JacobianMatrix;
37 using SingleTypeVector = decltype(VectorConverter<Vector>::multiTypeToBlockVector(std::declval<Vector>()));
38 using SingleTypeMatrix = decltype(MatrixConverter<Matrix>::multiTypeToBCRSMatrix(std::declval<Matrix>()));
39};
40
41} // end namespace Dumux::Detail::LATraits
42
43namespace Dumux {
44
45/*
46 * \ingroup Linear
47 * \brief Traits providing linear algebra types (vector, matrix)
48 */
49template<class M, class V, class STM = M, class STV = V>
51{
52 using Matrix = M;
53 using Vector = V;
54 using SingleTypeMatrix = STM;
55 using SingleTypeVector = STV;
56};
57
58/*
59 * \ingroup Linear
60 * \brief Helper to extract linear algebra types from an assembler
61 */
62template<class Assembler>
66 >;
67
68} // end namespace Dumux
69
70#endif
static auto multiTypeToBCRSMatrix(const MultiTypeBlockMatrix &A)
Converts the matrix to a type the IterativeSolverBackend can handle.
Definition: matrixconverter.hh:46
static auto multiTypeToBlockVector(const MultiTypeBlockVector &b)
Converts a Dune::MultiTypeBlockVector to a plain 1x1 Dune::BlockVector.
Definition: matrixconverter.hh:203
A helper class that converts a Dune::MultiTypeBlockMatrix into a plain Dune::BCRSMatrix.
Definition: linearalgebratraits.hh:21
Definition: adapt.hh:17
decltype(MatrixConverter< Matrix >::multiTypeToBCRSMatrix(std::declval< Matrix >())) SingleTypeMatrix
Definition: linearalgebratraits.hh:38
typename Assembler::JacobianMatrix Matrix
Definition: linearalgebratraits.hh:36
decltype(VectorConverter< Vector >::multiTypeToBlockVector(std::declval< Vector >())) SingleTypeVector
Definition: linearalgebratraits.hh:37
typename Assembler::ResidualType Vector
Definition: linearalgebratraits.hh:35
Definition: linearalgebratraits.hh:25
Matrix SingleTypeMatrix
Definition: linearalgebratraits.hh:29
Vector SingleTypeVector
Definition: linearalgebratraits.hh:28
typename Assembler::ResidualType Vector
Definition: linearalgebratraits.hh:26
typename Assembler::JacobianMatrix Matrix
Definition: linearalgebratraits.hh:27
Definition: linearalgebratraits.hh:51
STM SingleTypeMatrix
Definition: linearalgebratraits.hh:54
V Vector
Definition: linearalgebratraits.hh:53
M Matrix
Definition: linearalgebratraits.hh:52
STV SingleTypeVector
Definition: linearalgebratraits.hh:55
Helper type to determine whether a given type is a Dune::MultiTypeBlockVector.
Definition: vector.hh:22
Type traits to be used with vector types.