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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/copy_constraints_residual_to_vector.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
copy_constraints_residual_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
20 size_t start_row;
24
26 void operator()(size_t constraint) const {
27 const auto first_row = row_range(constraint).first + start_row;
28 const auto num_rows = row_range(constraint).second - row_range(constraint).first;
29 constexpr auto force_atomic =
30 !std::is_same_v<typename DeviceType::execution_space, Kokkos::Serial>;
31 for (auto component = 0U; component < num_rows; ++component) {
32 if constexpr (force_atomic) {
33 Kokkos::atomic_add(
36 );
37 } else {
40 }
41 }
42 }
43};
44} // namespace kynema::solver
Definition calculate_error_sum_squares.hpp:5
A Kernel which copies the residual contributions for each constraint to their correct location in the...
Definition copy_constraints_residual_to_vector.hpp:12
typename View< ValueType >::const_type ConstView
Definition copy_constraints_residual_to_vector.hpp:16
Kokkos::View< ValueType, Kokkos::LayoutLeft, DeviceType > LeftView
Definition copy_constraints_residual_to_vector.hpp:18
size_t start_row
Definition copy_constraints_residual_to_vector.hpp:20
ConstView< double *[6]> constraint_residual_terms
Definition copy_constraints_residual_to_vector.hpp:22
Kokkos::View< ValueType, DeviceType > View
Definition copy_constraints_residual_to_vector.hpp:14
ConstView< Kokkos::pair< size_t, size_t > * > row_range
Definition copy_constraints_residual_to_vector.hpp:21
KOKKOS_FUNCTION void operator()(size_t constraint) const
Definition copy_constraints_residual_to_vector.hpp:26
LeftView< double *[1]> residual
Definition copy_constraints_residual_to_vector.hpp:23