/home/runner/work/kynema-fmb/kynema-fmb/kynema-fmb/src/solver/contribute_beams_to_vector.hpp Source File

Kynema API: /home/runner/work/kynema-fmb/kynema-fmb/kynema-fmb/src/solver/contribute_beams_to_vector.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
contribute_beams_to_vector.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
5namespace kynema_fmb::solver {
6
11template <typename DeviceType>
13 using TeamPolicy = Kokkos::TeamPolicy<typename DeviceType::execution_space>;
14 using member_type = typename TeamPolicy::member_type;
15 template <typename ValueType>
16 using View = Kokkos::View<ValueType, DeviceType>;
17 template <typename ValueType>
19 template <typename ValueType>
20 using LeftView = Kokkos::View<ValueType, Kokkos::LayoutLeft, DeviceType>;
21
26
29 const auto element = static_cast<size_t>(member.league_rank());
30 const auto num_nodes = num_nodes_per_element(element);
31 constexpr auto force_atomic =
32 !std::is_same_v<typename DeviceType::execution_space, Kokkos::Serial>;
33
34 Kokkos::parallel_for(
35 Kokkos::TeamVectorRange(member, num_nodes * 6U), [&](size_t node_component) {
36 const auto node = node_component % num_nodes;
37 const auto component = node_component / num_nodes;
38 const auto entry = element_freedom_table(element, node, component);
39 if constexpr (force_atomic) {
40 Kokkos::atomic_add(&vector(entry, 0), elements(element, node, component));
41 } else {
42 vector(entry, 0) += elements(element, node, component);
43 }
44 }
45 );
46 }
47};
48
49} // namespace kynema_fmb::solver
Definition calculate_error_sum_squares.hpp:5
A Kernel which sums the residual contributions computed at each node in a beam into the correct locat...
Definition contribute_beams_to_vector.hpp:12
LeftView< double *[1]> vector
Definition contribute_beams_to_vector.hpp:25
KOKKOS_FUNCTION void operator()(member_type member) const
Definition contribute_beams_to_vector.hpp:28
ConstView< size_t * > num_nodes_per_element
Definition contribute_beams_to_vector.hpp:22
ConstView< size_t **[6]> element_freedom_table
Definition contribute_beams_to_vector.hpp:23
typename View< ValueType >::const_type ConstView
Definition contribute_beams_to_vector.hpp:18
Kokkos::View< ValueType, Kokkos::LayoutLeft, DeviceType > LeftView
Definition contribute_beams_to_vector.hpp:20
ConstView< double **[6]> elements
Definition contribute_beams_to_vector.hpp:24
Kokkos::View< ValueType, DeviceType > View
Definition contribute_beams_to_vector.hpp:16
Kokkos::TeamPolicy< typename DeviceType::execution_space > TeamPolicy
Definition contribute_beams_to_vector.hpp:13
typename TeamPolicy::member_type member_type
Definition contribute_beams_to_vector.hpp:14