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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_numeric_superlu_mt.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_numeric_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>
11struct NumericFunction<DSSHandle<Algorithm::SUPERLU_MT>, CrsMatrixType> {
12 static void numeric(Handle<Algorithm::SUPERLU_MT>& dss_handle, CrsMatrixType& A) {
13 auto num_rows = A.numRows();
14 auto num_cols = A.numCols();
15 auto num_non_zero = A.nnz();
16
17 auto values = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.values);
18 auto row_ptrs = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.row_map);
19 auto col_inds = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.entries);
20
21 auto& options = dss_handle.get_options();
22 auto& stat = dss_handle.get_stat();
23 auto& L = dss_handle.get_L();
24 auto& U = dss_handle.get_U();
25
26 SuperMatrix Amatrix;
27 dCreate_CompCol_Matrix(
28 &Amatrix, num_rows, num_cols, num_non_zero, values.data(), col_inds.data(),
29 const_cast<int*>(row_ptrs.data()), SLU_NC, SLU_D, SLU_GE
30 );
31 auto info = 0;
32
33 SuperMatrix AC;
34 sp_colorder(&Amatrix, options.perm_c, &options, &AC);
35
36 pdgstrf(&options, &AC, options.perm_r, &L, &U, &stat, &info);
37
38 Destroy_CompCol_Permuted(&AC);
39
40 options.refact = YES;
41 }
42};
43
44} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void numeric(Handle< Algorithm::SUPERLU_MT > &dss_handle, CrsMatrixType &A)
Definition dss_numeric_superlu_mt.hpp:12
Definition dss_numeric.hpp:8