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 
53  template <typename T, typename S>
55  {
56 #ifndef WITH_PETSC
57  throw std::runtime_error("The PETSc backend was not enabled");
58 #else
59  init_vector_petsc(object);
60 #endif
61  }
62 
64  template <typename T, typename S>
66  {
67 #ifndef WITH_PETSC
68  throw std::runtime_error("The PETSc backend was not enabled");
69 #else
70  init_matrix_petsc(object);
71 #endif
72  }
73 
75  template <typename T, typename S>
77  {
78 #ifndef WITH_PETSC
79  throw std::runtime_error("The PETSc backend was not enabled");
80 #else
81  init_solver_petsc(object);
82 #endif
83  }
84 
85 } // namespace detail
86 
87 
99 template <class T, class S>
101 {
102  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
104  } else {
106  }
107 }
108 
124 template <class T, class S>
125 inline void init_vector(SF::abstract_vector<T, S>** vec, int igsize,
126  int ilsize, int idpn = 1,
128 {
129  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
131  } else {
133  }
134  (*vec)->init(igsize, ilsize, idpn, ilayout);
135 }
136 
151 template <class T, class S>
154  int i, typename SF::abstract_vector<T, S>::ltype ltype)
155 {
156  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
158  } else {
160  }
161  (*vec)->init(mesh, i, ltype);
162 }
163 
176 template <class T, class S>
179 {
180  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
182  } else {
184  }
185  (*vec)->init(*in);
186 }
187 
199 template <class T, class S>
201 {
202  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
204  } else {
206  }
207 }
208 
220 template <class T, class S>
222 {
223  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
225  } else {
227  }
228 }
229 
230 
231 } // namespace SF
232 
233 #endif // _SF_INIT_H_
void init_solver(SF::abstract_linear_solver< T, S > **sol)
Definition: SF_init.h:221
Definition: dense_mat.hpp:34
void init_vector(SF::abstract_vector< T, S > **vec)
Definition: SF_init.h:100
void init_matrix(SF::abstract_matrix< T, S > **mat)
Definition: SF_init.h:200
void init_or_throw_ginkgo(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:21
void init_or_throw_petsc(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:54