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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/contribute_masses_to_vector.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
contribute_masses_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(1); ++component) {
29 if constexpr (force_atomic) {
30 Kokkos::atomic_add(
32 elements(element, component)
33 );
34 } else {
35 vector(element_freedom_table(element, component), 0) += elements(element, component);
36 }
37 }
38 }
39};
40
41} // namespace kynema::solver
Definition calculate_error_sum_squares.hpp:5
A Kernel which sums the residual contributions computed at a mass element's node into the correct loc...
Definition contribute_masses_to_vector.hpp:12
Kokkos::View< ValueType, DeviceType > View
Definition contribute_masses_to_vector.hpp:14
ConstView< double *[6]> elements
Definition contribute_masses_to_vector.hpp:21
ConstView< size_t *[6]> element_freedom_table
Definition contribute_masses_to_vector.hpp:20
LeftView< double *[1]> vector
Definition contribute_masses_to_vector.hpp:22
typename View< ValueType >::const_type ConstView
Definition contribute_masses_to_vector.hpp:16
KOKKOS_FUNCTION void operator()(size_t element) const
Definition contribute_masses_to_vector.hpp:25
Kokkos::View< ValueType, Kokkos::LayoutLeft, DeviceType > LeftView
Definition contribute_masses_to_vector.hpp:18