openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
SF_init.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) NumeriCor GmbH
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #ifndef _SF_INIT_H_
5 #define _SF_INIT_H_
6 
7 #include "SF_abstract_vector.h"
8 #include "SF_abstract_matrix.h"
10 
11 #include "SF_ginkgo_vector.h"
12 #include "SF_ginkgo_matrix.h"
13 #include "SF_ginkgo_solver.h"
14 
15 #include "SF_petsc_vector.h"
16 #include "SF_petsc_matrix.h"
17 #include "SF_petsc_solver.h"
18 
19 namespace SF {
20 namespace detail {
21 
22  template <typename T>
23  struct non_deduced {
24  using type = T;
25  };
26 
27  template <typename T>
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_vector_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_matrix_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_solver_ginkgo(object);
60 #endif
61  }
62 
65  {
66 #ifndef WITH_PETSC
67  throw std::runtime_error("The PETSc backend was not enabled");
68 #else
69  init_vector_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_matrix_petsc(object);
81 #endif
82  }
83 
85  template <typename T, typename S>
87  {
88 #ifndef WITH_PETSC
89  throw std::runtime_error("The PETSc backend was not enabled");
90 #else
91  init_solver_petsc(object);
92 #endif
93  }
94 
95 } // namespace detail
96 
97 
109 template <class T, class S>
111 {
112  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
114  } else {
116  }
117 }
118 
134 template <class T, class S>
137  detail::non_deduced_t<T> ilsize, int idpn = 1,
139 {
140  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
142  } else {
144  }
145  (*vec)->init(igsize, ilsize, idpn, ilayout);
146 }
147 
162 template <class T, class S>
165  int i, typename SF::abstract_vector<T, S>::ltype ltype)
166 {
167  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
169  } else {
171  }
172  (*vec)->init(mesh, i, ltype);
173 }
174 
187 template <class T, class S>
190 {
191  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
193  } else {
195  }
196  (*vec)->init(*in);
197 }
198 
210 template <class T, class S>
212 {
213  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
215  } else {
217  }
218 }
219 
231 template <class T, class S>
233 {
234  if ((param_globals::flavor != nullptr) && (std::string{param_globals::flavor} == "ginkgo")) {
236  } else {
238  }
239 }
240 
241 
242 } // namespace SF
243 
244 #endif // _SF_INIT_H_
void init_or_throw_petsc(SF::abstract_vector< SF_int, SF_real > **object)
Definition: SF_init.h:64
typename non_deduced< T >::type non_deduced_t
Definition: SF_init.h:28
void init_or_throw_ginkgo(SF::abstract_vector< T, S > **object)
Definition: SF_init.h:32
Definition: dense_mat.hpp:19
void init_solver(SF::abstract_linear_solver< T, S > **sol)
Definition: SF_init.h:232
void init_vector(SF::abstract_vector< T, S > **vec)
Definition: SF_init.h:110
void init_matrix(SF::abstract_matrix< T, S > **mat)
Definition: SF_init.h:211