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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_solve_superlu.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_solve_superlu.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
5#include "dss_algorithm.hpp"
7#include "slu_ddefs.h"
8
9namespace kynema::dss {
10template <typename CrsMatrixType, typename MultiVectorType>
11struct SolveFunction<Handle<Algorithm::SUPERLU>, CrsMatrixType, MultiVectorType> {
12 static void solve(
13 Handle<Algorithm::SUPERLU>& dss_handle, CrsMatrixType&, MultiVectorType& b,
14 MultiVectorType& x
15 ) {
16 auto& stat = dss_handle.get_stat();
17 auto& L = dss_handle.get_L();
18 auto& U = dss_handle.get_U();
19 auto& perm_r = dss_handle.get_perm_r();
20 auto& perm_c = dss_handle.get_perm_c();
21
22 Kokkos::deep_copy(x, b);
23 auto x_host = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), x);
24
25 SuperMatrix Xmatrix;
26 dCreate_Dense_Matrix(
27 &Xmatrix, static_cast<int>(x.extent(0)), static_cast<int>(x.extent(1)), x_host.data(),
28 static_cast<int>(x.extent(0)), SLU_DN, SLU_D, SLU_GE
29 );
30
31 auto info = 0;
32 dgstrs(TRANS, &L, &U, perm_c.data(), perm_r.data(), &Xmatrix, &stat, &info);
33
34 Kokkos::deep_copy(x, x_host);
35 }
36};
37
38} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void solve(Handle< Algorithm::SUPERLU > &dss_handle, CrsMatrixType &, MultiVectorType &b, MultiVectorType &x)
Definition dss_solve_superlu.hpp:12
Definition dss_solve.hpp:8