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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_solve_superlu_mt.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_solve_superlu_mt.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_mt_ddefs.h"
8
9namespace kynema::dss {
10template <typename CrsMatrixType, typename MultiVectorType>
11struct SolveFunction<Handle<DSSAlgorithm::SUPERLU_MT>, CrsMatrixType, MultiVectorType> {
12 static void solve(
13 Handle<Algorithm::SUPERLU_MT>& dss_handle, CrsMatrixType&, MultiVectorType& b,
14 MultiVectorType& x
15 ) {
16 auto& options = dss_handle.get_options();
17 auto& stat = dss_handle.get_stat();
18 auto& L = dss_handle.get_L();
19 auto& U = dss_handle.get_U();
20
21 Kokkos::deep_copy(x, b);
22
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, options.perm_r, options.perm_c, &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
static void solve(Handle< Algorithm::SUPERLU_MT > &dss_handle, CrsMatrixType &, MultiVectorType &b, MultiVectorType &x)
Definition dss_solve_superlu_mt.hpp:12
Definition dss_solve.hpp:8