/home/runner/work/kynema/kynema/kynema/src/solver/contribute_springs_to_vector.hpp Source File

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