/home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_solve_klu.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_solve_klu.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_solve_klu.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <klu.h>
5
6#include "dss_algorithm.hpp"
7#include "dss_handle_klu.hpp"
8
9namespace kynema::dss {
10template <typename CrsMatrixType, typename MultiVectorType>
11struct SolveFunction<Handle<Algorithm::KLU>, CrsMatrixType, MultiVectorType> {
12 static void solve(
13 Handle<Algorithm::KLU>& dss_handle, CrsMatrixType& A, MultiVectorType& b, MultiVectorType& x
14 ) {
15 const auto num_rows = A.numRows();
16
17 auto*& symbolic = dss_handle.get_symbolic();
18 auto*& numeric = dss_handle.get_numeric();
19 auto& common = dss_handle.get_common();
20
21 Kokkos::deep_copy(x, b);
22 auto x_host = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), x);
23
24 klu_tsolve(symbolic, numeric, num_rows, 1, x_host.data(), &common);
25 Kokkos::deep_copy(x, x_host);
26 }
27};
28
29} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void solve(Handle< Algorithm::KLU > &dss_handle, CrsMatrixType &A, MultiVectorType &b, MultiVectorType &x)
Definition dss_solve_klu.hpp:12
Definition dss_solve.hpp:8