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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/system/beams/update_node_state.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
update_node_state.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <KokkosBatched_Copy_Decl.hpp>
4#include <Kokkos_Core.hpp>
5
6namespace kynema::beams {
7
8template <typename DeviceType>
10 template <typename ValueType>
11 using View = Kokkos::View<ValueType, DeviceType>;
12 template <typename ValueType>
14
15 size_t element{};
20
24
26 void operator()(const size_t node) const {
27 const auto index = node_state_indices(element, node);
28 for (auto component = 0U; component < 7U; ++component) {
29 node_u(node, component) = Q(index, component);
30 }
31 for (auto component = 0U; component < 6U; ++component) {
32 node_u_dot(node, component) = V(index, component);
33 node_u_ddot(node, component) = A(index, component);
34 }
35 }
36};
37
38template <typename DeviceType>
40 using TeamPolicy = typename Kokkos::TeamPolicy<typename DeviceType::execution_space>;
41 using member_type = typename TeamPolicy::member_type;
42 template <typename ValueType>
43 using View = Kokkos::View<ValueType, DeviceType>;
44 template <typename ValueType>
46
55
58 const auto element = static_cast<size_t>(member.league_rank());
59 const auto num_nodes = num_nodes_per_element(element);
60 const auto node_range = Kokkos::TeamThreadRange(member, num_nodes);
61
62 const auto node_u = View<double* [7]>(member.team_scratch(1), num_nodes);
63 const auto node_u_dot = View<double* [6]>(member.team_scratch(1), num_nodes);
64 const auto node_u_ddot = View<double* [6]>(member.team_scratch(1), num_nodes);
65
67 element, node_state_indices, node_u, node_u_dot, node_u_ddot, Q, V, A
68 };
69 Kokkos::parallel_for(node_range, node_state_updater);
70
71 using CopyMatrix = KokkosBatched::TeamVectorCopy<member_type>;
72
73 CopyMatrix::invoke(
74 member, node_u, Kokkos::subview(node_u_, element, Kokkos::ALL, Kokkos::ALL)
75 );
76 CopyMatrix::invoke(
77 member, node_u_dot, Kokkos::subview(node_u_dot_, element, Kokkos::ALL, Kokkos::ALL)
78 );
79 CopyMatrix::invoke(
80 member, node_u_ddot, Kokkos::subview(node_u_ddot_, element, Kokkos::ALL, Kokkos::ALL)
81 );
82 }
83};
84
85} // namespace kynema::beams
Definition beam_quadrature.hpp:16
Definition update_node_state.hpp:9
size_t element
Definition update_node_state.hpp:15
View< double *[6]> node_u_dot
Definition update_node_state.hpp:18
KOKKOS_FUNCTION void operator()(const size_t node) const
Definition update_node_state.hpp:26
ConstView< size_t ** > node_state_indices
Definition update_node_state.hpp:16
View< double *[6]> node_u_ddot
Definition update_node_state.hpp:19
Kokkos::View< ValueType, DeviceType > View
Definition update_node_state.hpp:11
typename View< ValueType >::const_type ConstView
Definition update_node_state.hpp:13
ConstView< double *[6]> A
Definition update_node_state.hpp:23
View< double *[7]> node_u
Definition update_node_state.hpp:17
ConstView< double *[7]> Q
Definition update_node_state.hpp:21
ConstView< double *[6]> V
Definition update_node_state.hpp:22
Definition update_node_state.hpp:39
ConstView< size_t * > num_nodes_per_element
Definition update_node_state.hpp:51
Kokkos::View< ValueType, DeviceType > View
Definition update_node_state.hpp:43
ConstView< double *[6]> V
Definition update_node_state.hpp:48
typename View< ValueType >::const_type ConstView
Definition update_node_state.hpp:45
KOKKOS_FUNCTION void operator()(member_type member) const
Definition update_node_state.hpp:57
View< double **[6]> node_u_dot_
Definition update_node_state.hpp:53
typename Kokkos::TeamPolicy< typename DeviceType::execution_space > TeamPolicy
Definition update_node_state.hpp:40
ConstView< size_t ** > node_state_indices
Definition update_node_state.hpp:50
ConstView< double *[6]> A
Definition update_node_state.hpp:49
ConstView< double *[7]> Q
Definition update_node_state.hpp:47
typename TeamPolicy::member_type member_type
Definition update_node_state.hpp:41
View< double **[6]> node_u_ddot_
Definition update_node_state.hpp:54
View< double **[7]> node_u_
Definition update_node_state.hpp:52