DiFfRG
Loading...
Searching...
No Matches
types.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
5
6// external libraries
7#include <autodiff/forward/real.hpp>
8#include <deal.II/lac/block_sparse_matrix.h>
9#include <deal.II/lac/block_sparsity_pattern.h>
10#include <deal.II/lac/block_vector.h>
11#include <deal.II/lac/sparse_direct.h>
12
13namespace DiFfRG
14{
15 template <typename T>
16 concept IsContainer = requires(T x) { x[0]; };
17
18 namespace get_type
19 {
20 namespace internal
21 {
22 //--------------------------------------------------
23 // Hidden unspecified type helpers
24 //--------------------------------------------------
25
26 template <typename VectorType> struct _NumberType;
27
28 template <typename SparseMatrixType> struct _SparsityPattern;
29
30 template <typename SparseMatrixType> struct _InverseSparseMatrixType;
31
32 //--------------------------------------------------
33 // Specified type helpers for standard vectors
34 //--------------------------------------------------
35
36 template <typename NT> struct _NumberType<dealii::Vector<NT>> {
37 using value = NT;
38 };
39 template <typename NT> struct _SparsityPattern<dealii::SparseMatrix<NT>> {
40 using value = dealii::SparsityPattern;
41 };
42 template <typename NT> struct _InverseSparseMatrixType<dealii::SparseMatrix<NT>> {
43 using value = dealii::SparseDirectUMFPACK;
44 };
45
46 //--------------------------------------------------
47 // Specified type helpers for block vectors
48 //--------------------------------------------------
49
50 template <typename NT> struct _NumberType<dealii::BlockVector<NT>> {
51 using value = NT;
52 };
53 template <typename NT> struct _SparsityPattern<dealii::BlockSparseMatrix<NT>> {
54 using value = dealii::BlockSparsityPattern;
55 };
56 template <typename NT> struct _InverseSparseMatrixType<dealii::BlockSparseMatrix<NT>> {
57 using value = dealii::SparseDirectUMFPACK;
58 };
59 } // namespace internal
60
61 template <typename VectorType> using NumberType = typename internal::_NumberType<VectorType>::value;
62
63 template <typename SparseMatrixType>
65
66 template <typename SparseMatrixType>
68
69 namespace internal
70 {
71 template <typename CT> struct _ctype;
72
73 template <> struct _ctype<float> {
74 using value = float;
75 };
76
77 template <> struct _ctype<double> {
78 using value = double;
79 };
80
81 template <> struct _ctype<complex<float>> {
82 using value = float;
83 };
84
85 template <> struct _ctype<complex<double>> {
86 using value = double;
87 };
88
89 template <> struct _ctype<autodiff::Real<1, float>> {
90 using value = float;
91 };
92
93 template <> struct _ctype<autodiff::Real<1, double>> {
94 using value = double;
95 };
96
97 template <> struct _ctype<autodiff::Real<1, complex<float>>> {
98 using value = float;
99 };
100
101 template <> struct _ctype<autodiff::Real<1, complex<double>>> {
102 using value = double;
103 };
104 } // namespace internal
105
106 template <typename CT> using ctype = typename internal::_ctype<CT>::value;
107 } // namespace get_type
108} // namespace DiFfRG
Definition types.hh:16
typename internal::_NumberType< VectorType >::value NumberType
Definition types.hh:61
typename internal::_ctype< CT >::value ctype
Definition types.hh:106
typename internal::_SparsityPattern< SparseMatrixType >::value SparsityPattern
Definition types.hh:64
typename internal::_InverseSparseMatrixType< SparseMatrixType >::value InverseSparseMatrixType
Definition types.hh:67
Definition complex_math.hh:14
Definition complex_math.hh:59
double value
Definition types.hh:78