/home/runner/work/kynema/kynema/kynema/src/system/beams/calculate_G_D1.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/beams/calculate_G_D1.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_G_D1.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <KokkosBatched_Gemm_Decl.hpp>
4#include <KokkosBlas.hpp>
5#include <KokkosBlas1_set.hpp>
6#include <Kokkos_Core.hpp>
7
10
11namespace kynema::beams {
12
13template <typename DeviceType>
15 template <typename ValueType>
16 using View = Kokkos::View<ValueType, DeviceType>;
17 template <typename ValueType>
19
21 const ConstView<double[4]>& r, const ConstView<double[3]>& xr_prime,
22 const ConstView<double[3]>& kappa, const ConstView<double[6][6]>& D,
23 const View<double[6][6]>& G_D1
24 ) {
25 using NoTranspose = KokkosBatched::Trans::NoTranspose;
26 using Default = KokkosBatched::Algo::Gemm::Default;
27 using GemmNN = KokkosBatched::SerialGemm<NoTranspose, NoTranspose, Default>;
28 using Kokkos::make_pair;
29 using Kokkos::subview;
30
31 KokkosBlas::SerialSet::invoke(0., G_D1);
32
33 auto r_xr_prime_data = Kokkos::Array<double, 3>{};
36 auto r_xr_prime_tilde_data = Kokkos::Array<double, 9>{};
39
40 auto kappa_tilde_data = Kokkos::Array<double, 9>{};
43
44 auto D11 = subview(D, make_pair(0, 3), make_pair(0, 3));
45 auto D12 = subview(D, make_pair(0, 3), make_pair(3, 6));
46 auto G_D1_12 = subview(G_D1, make_pair(0, 3), make_pair(3, 6));
47 GemmNN::invoke(1., D11, r_xr_prime_tilde, 0., G_D1_12);
48 GemmNN::invoke(-1., D12, kappa_tilde, 1., G_D1_12);
49
50 auto D21 = subview(D, make_pair(3, 6), make_pair(0, 3));
51 auto D22 = subview(D, make_pair(3, 6), make_pair(3, 6));
52 auto G_D1_22 = subview(G_D1, make_pair(3, 6), make_pair(3, 6));
53 GemmNN::invoke(1., D21, r_xr_prime_tilde, 0., G_D1_22);
54 GemmNN::invoke(-1., D22, kappa_tilde, 1., G_D1_22);
55 }
56};
57} // namespace kynema::beams
Definition beam_quadrature.hpp:14
KOKKOS_INLINE_FUNCTION void VecTilde(const VectorType &vector, const MatrixType &matrix)
Converts a 3x1 vector to a 3x3 skew-symmetric matrix and returns the result.
Definition vector_operations.hpp:10
KOKKOS_INLINE_FUNCTION void RotateVectorByQuaternion(const Quaternion &q, const View1 &v, const View2 &v_rot)
Rotates provided vector by provided unit quaternion and returns the result.
Definition quaternion_operations.hpp:34
Definition calculate_G_D1.hpp:14
Kokkos::View< ValueType, DeviceType > View
Definition calculate_G_D1.hpp:16
static KOKKOS_FUNCTION void invoke(const ConstView< double[4]> &r, const ConstView< double[3]> &xr_prime, const ConstView< double[3]> &kappa, const ConstView< double[6][6]> &D, const View< double[6][6]> &G_D1)
Definition calculate_G_D1.hpp:20
typename View< ValueType >::const_type ConstView
Definition calculate_G_D1.hpp:18