/home/runner/work/kynema/kynema/kynema/src/system/masses/rotate_section_matrix.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/masses/rotate_section_matrix.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
rotate_section_matrix.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <KokkosBatched_Gemm_Decl.hpp>
4#include <KokkosBlas.hpp>
5#include <Kokkos_Core.hpp>
6
8
9namespace kynema::masses {
10
11template <typename DeviceType>
13 template <typename ValueType>
14 using View = Kokkos::View<ValueType, DeviceType>;
15 template <typename ValueType>
18 const ConstView<double[4]>& xr, const ConstView<double[6][6]>& Cstar,
19 const View<double[6][6]>& Cuu
20 ) {
21 using NoTranspose = KokkosBatched::Trans::NoTranspose;
22 using Transpose = KokkosBatched::Trans::Transpose;
23 using Default = KokkosBatched::Algo::Gemm::Default;
24 using GemmNN = KokkosBatched::SerialGemm<NoTranspose, NoTranspose, Default>;
25 using GemmNT = KokkosBatched::SerialGemm<NoTranspose, Transpose, Default>;
26 using Kokkos::ALL;
27 using Kokkos::Array;
28 using Kokkos::make_pair;
29 using Kokkos::subview;
30
32 auto RR0 = View<double[3][3]>(RR0_data.data());
34
35 const auto Cstar_top = subview(Cstar, make_pair(0, 3), ALL);
36 const auto Cstar_bottom = subview(Cstar, make_pair(3, 6), ALL);
37 const auto Cuu_left = subview(Cuu, ALL, make_pair(0, 3));
38 const auto Cuu_right = subview(Cuu, ALL, make_pair(3, 6));
39
41 const auto Ctmp = View<double[6][6]>(ctmp_data.data());
42 const auto Ctmp_top = subview(Ctmp, make_pair(0, 3), ALL);
43 const auto Ctmp_bottom = subview(Ctmp, make_pair(3, 6), ALL);
44 const auto Ctmp_left = subview(Ctmp, ALL, make_pair(0, 3));
45 const auto Ctmp_right = subview(Ctmp, ALL, make_pair(3, 6));
46
47 GemmNN::invoke(1., RR0, Cstar_top, 0., Ctmp_top);
48 GemmNN::invoke(1., RR0, Cstar_bottom, 0., Ctmp_bottom);
49 GemmNT::invoke(1., Ctmp_left, RR0, 0., Cuu_left);
50 GemmNT::invoke(1., Ctmp_right, RR0, 0., Cuu_right);
51 }
52};
53} // namespace kynema::masses
Definition calculate_gravity_force.hpp:6
KOKKOS_INLINE_FUNCTION void QuaternionToRotationMatrix(const Quaternion &q, const RotationMatrix &R)
Converts a 4x1 quaternion to a 3x3 rotation matrix and returns the result.
Definition quaternion_operations.hpp:20
Definition rotate_section_matrix.hpp:12
typename View< ValueType >::const_type ConstView
Definition rotate_section_matrix.hpp:16
static KOKKOS_FUNCTION void invoke(const ConstView< double[4]> &xr, const ConstView< double[6][6]> &Cstar, const View< double[6][6]> &Cuu)
Definition rotate_section_matrix.hpp:17
Kokkos::View< ValueType, DeviceType > View
Definition rotate_section_matrix.hpp:14