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 
20  template <typename T, typename S>
22  {
23 #ifndef WITH_GINKGO
24  throw std::runtime_error("The Ginkgo backend was not enabled");
25 #else
26  init_vector_ginkgo(object);
27 #endif
28  }
29 
31  template <typename T, typename S>
33  {
34 #ifndef WITH_GINKGO
35  throw std::runtime_error("The Ginkgo backend was not enabled");
36 #else
37  init_matrix_ginkgo(object);
38 #endif
39  }
40 
42  template <typename T, typename S>
44  {
45 #ifndef WITH_GINKGO
46  throw std::runtime_error("The Ginkgo backend was not enabled");
47 #else
48  init_solver_ginkgo(object);
49 #endif
50  }
51 
54  {
55 #ifndef WITH_PETSC
56  throw std::runtime_error("The PETSc backend was not enabled");
57 #else
58  init_vector_petsc(object);
59 #endif
60  }
61 
63  template <typename T, typename S>
65  {
66 #ifndef WITH_PETSC
67  throw std::runtime_error("The PETSc backend was not enabled");
68 #else
69  init_matrix_petsc(object);
70 #endif
71  }
72 
74  template <typename T, typename S>
76  {
77 #ifndef WITH_PETSC
78  throw std::runtime_error("The PETSc backend was not enabled");
79 #else
80  init_solver_petsc(object);
81 #endif
82  }
83 
84 } // namespace detail
85 
86 
98 template <class T, class S>
100 {
101  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
103  } else {
105  }
106 }
107 
123 template <class T, class S>
124 inline void init_vector(SF::abstract_vector<T, S>** vec, int igsize,
125  int ilsize, int idpn = 1,
127 {
128  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
130  } else {
132  }
133  (*vec)->init(igsize, ilsize, idpn, ilayout);
134 }
135 
150 template <class T, class S>
153  int i, typename SF::abstract_vector<T, S>::ltype ltype)
154 {
155  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
157  } else {
159  }
160  (*vec)->init(mesh, i, ltype);
161 }
162 
175 template <class T, class S>
178 {
179  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
181  } else {
183  }
184  (*vec)->init(*in);
185 }
186 
198 template <class T, class S>
200 {
201  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
203  } else {
205  }
206 }
207 
219 template <class T, class S>
221 {
222  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
224  } else {
226  }
227 }
228 
229 
230 } // namespace SF
231 
232 #endif // _SF_INIT_H_
void init_solver(SF::abstract_linear_solver< T, S > **sol)
Definition: SF_init.h:220
Definition: dense_mat.hpp:34
void init_or_throw_petsc(SF::abstract_vector< SF_int, SF_real > **object)
Definition: SF_init.h:53
void init_vector(SF::abstract_vector< T, S > **vec)
Definition: SF_init.h:99
void init_matrix(SF::abstract_matrix< T, S > **mat)
Definition: SF_init.h:199
void init_or_throw_ginkgo(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:21