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_GINKGO
57  throw std::runtime_error("The Ginkgo backend was not enabled");
58 #else
59  init_nl_solver_ginkgo(object); //init nonlinear ginkgo_solver needs to be defined
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_vector_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_matrix_petsc(object);
82 #endif
83  }
84 
86  template <typename T, typename S>
88  {
89 #ifndef WITH_PETSC
90  throw std::runtime_error("The PETSc backend was not enabled");
91 #else
92  init_solver_petsc(object);
93 #endif
94  }
95 
97 template <typename T, typename S>
99 {
100 #ifndef WITH_PETSC
101  throw std::runtime_error("The PETSc backend was not enabled");
102 #else
103  init_nl_solver_petsc(object); //init nonlinear petsc solver still needs to be defined
104 #endif
105 }
106 
107 } // namespace detail
108 
109 
121 template <class T, class S>
123 {
124  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
126  } else {
128  }
129 }
130 
146 template <class T, class S>
147 inline void init_vector(SF::abstract_vector<T, S>** vec, int igsize,
148  int ilsize, int idpn = 1,
150 {
151  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
153  } else {
155  }
156  (*vec)->init(igsize, ilsize, idpn, ilayout);
157 }
158 
173 template <class T, class S>
176  int i, typename SF::abstract_vector<T, S>::ltype ltype)
177 {
178  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
180  } else {
182  }
183  (*vec)->init(mesh, i, ltype);
184 }
185 
198 template <class T, class S>
201 {
202  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
204  } else {
206  }
207  (*vec)->init(*in);
208 }
209 
221 template <class T, class S>
223 {
224  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
226  } else {
228  }
229 }
230 
242 template <class T, class S>
244 {
245  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
247  } else {
249  }
250 }
251 
252 // same for nonlinear solver
253 template <class T, class S>
255 {
256  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
258  } else {
260  }
261 }
262 
263 
264 } // namespace SF
265 
266 #endif // _SF_INIT_H_
void init_or_throw_petsc(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:65
void init_or_throw_ginkgo(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:21
Definition: dense_mat.hpp:34
void init_solver(SF::abstract_linear_solver< T, S > **sol)
Definition: SF_init.h:243
void init_vector(SF::abstract_vector< T, S > **vec)
Definition: SF_init.h:122
void init_matrix(SF::abstract_matrix< T, S > **mat)
Definition: SF_init.h:222
NOTE: A LOT OF THESE THINGS NEED TO BE CHANGED AT A LATER STAGE. THEY ARE CURRENTLY COPIED FROM THE A...