/home/runner/work/kynema/kynema/kynema/src/constraints/update_lambda_prediction.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/constraints/update_lambda_prediction.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
update_lambda_prediction.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
5namespace kynema::constraints {
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 template <typename ValueType>
21
26
28 void operator()(size_t constraint) const {
29 const auto first_index = row_range(constraint).first;
30 const auto max_index = row_range(constraint).second;
31 constexpr auto force_atomic =
32 !std::is_same_v<typename DeviceType::execution_space, Kokkos::Serial>;
33 for (auto row = first_index; row < max_index; ++row) {
34 if constexpr (force_atomic) {
35 Kokkos::atomic_add(
36 &lambda(constraint, row - first_index), x(num_system_dofs + row, 0)
37 );
38 } else {
39 lambda(constraint, row - first_index) += x(num_system_dofs + row, 0);
40 }
41 }
42 }
43};
44
45} // namespace kynema::constraints
Definition calculate_constraint_output.hpp:8
A Kernel to update the predicted constraint Lagrange multiplier values at each nonlinear iteration.
Definition update_lambda_prediction.hpp:12
typename LeftView< ValueType >::const_type ConstLeftView
Definition update_lambda_prediction.hpp:20
View< double *[6]> lambda
Definition update_lambda_prediction.hpp:25
Kokkos::View< ValueType, DeviceType > View
Definition update_lambda_prediction.hpp:14
KOKKOS_FUNCTION void operator()(size_t constraint) const
Definition update_lambda_prediction.hpp:28
ConstLeftView< double *[1]> x
Definition update_lambda_prediction.hpp:24
typename View< ValueType >::const_type ConstView
Definition update_lambda_prediction.hpp:16
ConstView< Kokkos::pair< size_t, size_t > * > row_range
Definition update_lambda_prediction.hpp:23
size_t num_system_dofs
Definition update_lambda_prediction.hpp:22
Kokkos::View< ValueType, Kokkos::LayoutLeft, DeviceType > LeftView
Definition update_lambda_prediction.hpp:18