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

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