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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_symbolic_superlu.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_symbolic_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>
11struct SymbolicFunction<Handle<Algorithm::SUPERLU>, CrsMatrixType> {
12 static void symbolic(Handle<Algorithm::SUPERLU>& 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 options.Fact = DOFACT;
23 auto& perm_r = dss_handle.get_perm_r();
24 auto& perm_c = dss_handle.get_perm_c();
25 auto& etree = dss_handle.get_etree();
26
27 perm_r.resize(static_cast<size_t>(num_rows));
28 perm_c.resize(static_cast<size_t>(num_cols));
29 etree.resize(static_cast<size_t>(num_rows));
30
31 SuperMatrix Amatrix;
32 dCreate_CompCol_Matrix(
33 &Amatrix, num_rows, num_cols, num_non_zero, values.data(), col_inds.data(),
34 const_cast<int*>(row_ptrs.data()), SLU_NC, SLU_D, SLU_GE
35 );
36 get_perm_c(options.ColPerm, &Amatrix, perm_c.data());
37 }
38};
39
40} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void symbolic(Handle< Algorithm::SUPERLU > &dss_handle, CrsMatrixType &A)
Definition dss_symbolic_superlu.hpp:12
Definition dss_symbolic.hpp:8