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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/compute_system_row_entries.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
compute_system_row_entries.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
5namespace kynema::solver {
6
10template <typename RowPtrType>
12 using ValueType = typename RowPtrType::value_type;
13 using DeviceType = typename RowPtrType::device_type;
14 template <typename value_type>
15 using View = Kokkos::View<value_type, DeviceType>;
16 template <typename value_type>
18
29
31 bool ElementContainsNode(size_t element, size_t node) const {
32 const auto num_nodes = num_nodes_per_element(element);
33 for (auto node_index = 0U; node_index < num_nodes; ++node_index) {
34 if (node_state_indices(element, node_index) == node) {
35 return true;
36 }
37 }
38 return false;
39 }
40
42 bool BaseContainsNode(size_t constraint, size_t dof_index) const {
43 return dof_index == base_node_freedom_table(constraint, 0) &&
44 base_active_dofs(constraint) != 0UL;
45 }
46
48 bool TargetContainsNode(size_t constraint, size_t dof_index) const {
49 return dof_index == target_node_freedom_table(constraint, 0) &&
50 target_active_dofs(constraint) != 0UL;
51 }
52
54 bool ConstraintContainsNode(size_t constraint, size_t dof_index) const {
55 return BaseContainsNode(constraint, dof_index) || TargetContainsNode(constraint, dof_index);
56 }
57
59 ValueType ComputeEntriesInConstraint(size_t constraint) const {
60 return static_cast<ValueType>(row_range(constraint).second - row_range(constraint).first);
61 }
62
64 ValueType ComputeEntriesInElement(size_t element) const {
65 const auto num_nodes = num_nodes_per_element(element);
66 auto entries = ValueType{};
67 for (auto node = 0U; node < num_nodes; ++node) {
68 const auto node_state_index = node_state_indices(element, node);
70 }
71 return entries;
72 }
73
75 void operator()(size_t node) const {
76 const auto num_dof = active_dofs(node);
77 const auto num_elements = num_nodes_per_element.extent(0);
78 const auto num_constraints = row_range.extent(0);
79 const auto dof_index = node_freedom_map_table(node);
80
81 auto entries_in_row = static_cast<ValueType>(num_dof);
82
83 for (auto element = 0U; element < num_elements; ++element) {
84 if (!ElementContainsNode(element, node)) {
85 continue;
86 }
87 const auto entries_in_element = ComputeEntriesInElement(element);
89 }
90
91 for (auto constraint = 0U; constraint < num_constraints; ++constraint) {
92 if (!ConstraintContainsNode(constraint, dof_index)) {
93 continue;
94 }
97 }
98
99 for (auto component = 0U; component < num_dof; ++component) {
101 }
102 }
103};
104
105} // namespace kynema::solver
Definition calculate_error_sum_squares.hpp:5
Kernel to compute the elements' contribution to the row pointers of the CRS matrix.
Definition compute_system_row_entries.hpp:11
KOKKOS_FUNCTION bool BaseContainsNode(size_t constraint, size_t dof_index) const
Definition compute_system_row_entries.hpp:42
KOKKOS_FUNCTION bool ElementContainsNode(size_t element, size_t node) const
Definition compute_system_row_entries.hpp:31
ConstView< size_t * > target_active_dofs
Definition compute_system_row_entries.hpp:24
KOKKOS_FUNCTION ValueType ComputeEntriesInConstraint(size_t constraint) const
Definition compute_system_row_entries.hpp:59
typename RowPtrType::value_type ValueType
Definition compute_system_row_entries.hpp:12
KOKKOS_FUNCTION ValueType ComputeEntriesInElement(size_t element) const
Definition compute_system_row_entries.hpp:64
ConstView< Kokkos::pair< size_t, size_t > * > row_range
Definition compute_system_row_entries.hpp:27
KOKKOS_FUNCTION bool TargetContainsNode(size_t constraint, size_t dof_index) const
Definition compute_system_row_entries.hpp:48
ConstView< size_t *[6]> target_node_freedom_table
Definition compute_system_row_entries.hpp:26
typename View< value_type >::const_type ConstView
Definition compute_system_row_entries.hpp:17
ConstView< size_t *[6]> base_node_freedom_table
Definition compute_system_row_entries.hpp:25
ConstView< size_t * > num_nodes_per_element
Definition compute_system_row_entries.hpp:21
KOKKOS_FUNCTION bool ConstraintContainsNode(size_t constraint, size_t dof_index) const
Definition compute_system_row_entries.hpp:54
ConstView< size_t * > node_freedom_map_table
Definition compute_system_row_entries.hpp:20
RowPtrType row_entries
Definition compute_system_row_entries.hpp:28
ConstView< size_t * > base_active_dofs
Definition compute_system_row_entries.hpp:23
typename RowPtrType::device_type DeviceType
Definition compute_system_row_entries.hpp:13
Kokkos::View< value_type, DeviceType > View
Definition compute_system_row_entries.hpp:15
KOKKOS_FUNCTION void operator()(size_t node) const
Definition compute_system_row_entries.hpp:75
ConstView< size_t ** > node_state_indices
Definition compute_system_row_entries.hpp:22
ConstView< size_t * > active_dofs
Definition compute_system_row_entries.hpp:19