openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
SF_init.h
Go to the documentation of this file.
1 #ifndef _SF_INIT_H_
2 #define _SF_INIT_H_
3 
4 #include "SF_abstract_vector.h"
5 #include "SF_abstract_matrix.h"
7 
8 #include "SF_ginkgo_vector.h"
9 #include "SF_ginkgo_matrix.h"
10 #include "SF_ginkgo_solver.h"
11 
12 #include "SF_petsc_vector.h"
13 #include "SF_petsc_matrix.h"
14 #include "SF_petsc_solver.h"
15 
16 namespace SF {
17 namespace detail {
18 
19  template <typename T>
20  struct non_deduced {
21  using type = T;
22  };
23 
24  template <typename T>
26 
28  template <typename T, typename S>
30  {
31 #ifndef WITH_GINKGO
32  throw std::runtime_error("The Ginkgo backend was not enabled");
33 #else
34  init_vector_ginkgo(object);
35 #endif
36  }
37 
39  template <typename T, typename S>
41  {
42 #ifndef WITH_GINKGO
43  throw std::runtime_error("The Ginkgo backend was not enabled");
44 #else
45  init_matrix_ginkgo(object);
46 #endif
47  }
48 
50  template <typename T, typename S>
52  {
53 #ifndef WITH_GINKGO
54  throw std::runtime_error("The Ginkgo backend was not enabled");
55 #else
56  init_solver_ginkgo(object);
57 #endif
58  }
59 
62  {
63 #ifndef WITH_PETSC
64  throw std::runtime_error("The PETSc backend was not enabled");
65 #else
66  init_vector_petsc(object);
67 #endif
68  }
69 
71  template <typename T, typename S>
73  {
74 #ifndef WITH_PETSC
75  throw std::runtime_error("The PETSc backend was not enabled");
76 #else
77  init_matrix_petsc(object);
78 #endif
79  }
80 
82  template <typename T, typename S>
84  {
85 #ifndef WITH_PETSC
86  throw std::runtime_error("The PETSc backend was not enabled");
87 #else
88  init_solver_petsc(object);
89 #endif
90  }
91 
92 } // namespace detail
93 
94 
106 template <class T, class S>
108 {
109  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
111  } else {
113  }
114 }
115 
131 template <class T, class S>
134  detail::non_deduced_t<T> ilsize, int idpn = 1,
136 {
137  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
139  } else {
141  }
142  (*vec)->init(igsize, ilsize, idpn, ilayout);
143 }
144 
159 template <class T, class S>
162  int i, typename SF::abstract_vector<T, S>::ltype ltype)
163 {
164  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
166  } else {
168  }
169  (*vec)->init(mesh, i, ltype);
170 }
171 
184 template <class T, class S>
187 {
188  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
190  } else {
192  }
193  (*vec)->init(*in);
194 }
195 
207 template <class T, class S>
209 {
210  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
212  } else {
214  }
215 }
216 
228 template <class T, class S>
230 {
231  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
233  } else {
235  }
236 }
237 
238 
239 } // namespace SF
240 
241 #endif // _SF_INIT_H_
void init_or_throw_petsc(SF::abstract_vector< SF_int, SF_real > **object)
Definition: SF_init.h:61
typename non_deduced< T >::type non_deduced_t
Definition: SF_init.h:25
void init_or_throw_ginkgo(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:29
Definition: dense_mat.hpp:34
void init_solver(SF::abstract_linear_solver< T, S > **sol)
Definition: SF_init.h:229
void init_vector(SF::abstract_vector< T, S > **vec)
Definition: SF_init.h:107
void init_matrix(SF::abstract_matrix< T, S > **mat)
Definition: SF_init.h:208