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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/linear_solver/dss_solve_umfpack.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
dss_solve_umfpack.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <umfpack.h>
5
6#include "dss_algorithm.hpp"
8
9namespace kynema::dss {
10template <typename CrsMatrixType, typename MultiVectorType>
11struct SolveFunction<Handle<Algorithm::UMFPACK>, CrsMatrixType, MultiVectorType> {
12 static void solve(
13 Handle<Algorithm::UMFPACK>& dss_handle, CrsMatrixType& A, MultiVectorType& b,
14 MultiVectorType& x
15 ) {
16 auto values = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.values);
17 auto row_ptrs = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.row_map);
18 auto col_inds = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A.graph.entries);
19
20 auto x_host = Kokkos::create_mirror_view(Kokkos::HostSpace(), x);
21 auto b_host = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), b);
22
23 auto*& numeric = dss_handle.get_numeric();
24 auto* control = dss_handle.get_control();
25
26 umfpack_di_solve(
27 UMFPACK_At, row_ptrs.data(), col_inds.data(), values.data(), x_host.data(),
28 b_host.data(), numeric, control, nullptr
29 );
30
31 Kokkos::deep_copy(x, x_host);
32 }
33};
34
35} // namespace kynema::dss
Definition dss_handle.hpp:10
Definition dss_algorithm.hpp:4
Algorithm
Definition dss_algorithm.hpp:6
static void solve(Handle< Algorithm::UMFPACK > &dss_handle, CrsMatrixType &A, MultiVectorType &b, MultiVectorType &x)
Definition dss_solve_umfpack.hpp:12
Definition dss_solve.hpp:8