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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_symbolic_klu.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_symbolic_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>
11struct SymbolicFunction<Handle<Algorithm::KLU>, CrsMatrixType> {
12 static void symbolic(Handle<Algorithm::KLU>& dss_handle, CrsMatrixType& A) {
13 const auto num_rows = A.numRows();
14
15 auto row_ptrs = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.row_map);
16 auto col_inds = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.entries);
17
18 auto*& symbolic = dss_handle.get_symbolic();
19 auto*& numeric = dss_handle.get_numeric();
20 auto& common = dss_handle.get_common();
21
22 if (symbolic != nullptr) {
23 klu_free_symbolic(&symbolic, &common);
24 }
25 if (numeric != nullptr) {
26 klu_free_numeric(&numeric, &common);
27 }
28 symbolic =
29 klu_analyze(num_rows, const_cast<int*>(row_ptrs.data()), col_inds.data(), &common);
30 }
31};
32
33} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void symbolic(Handle< Algorithm::KLU > &dss_handle, CrsMatrixType &A)
Definition dss_symbolic_klu.hpp:12
Definition dss_symbolic.hpp:8