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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/solver/compute_row_ptrs.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
compute_row_ptrs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4
8
9namespace kynema::solver {
10
15template <typename RowPtrType>
17 using DeviceType = typename RowPtrType::device_type;
18 template <typename ValueType>
19 using View = Kokkos::View<ValueType, DeviceType>;
20 template <typename ValueType>
22
24 size_t num_system_dofs, size_t num_dofs, const ConstView<size_t*>& active_dofs,
25 const ConstView<size_t*>& node_freedom_map_table,
26 const ConstView<size_t*>& num_nodes_per_element,
27 const ConstView<size_t**>& node_state_indices, const ConstView<size_t*>& base_active_dofs,
28 const ConstView<size_t*>& target_active_dofs,
29 const ConstView<size_t* [6]>& base_node_freedom_table,
30 const ConstView<size_t* [6]>& target_node_freedom_table,
31 const ConstView<Kokkos::pair<size_t, size_t>*>& row_range
32 ) {
33 using Kokkos::deep_copy;
34 using Kokkos::parallel_for;
35 using Kokkos::subview;
36 using Kokkos::view_alloc;
37 using Kokkos::WithoutInitializing;
38 using RangePolicy = Kokkos::RangePolicy<typename RowPtrType::execution_space>;
39
40 const auto row_entries =
41 RowPtrType(view_alloc("row_entries", WithoutInitializing), num_dofs);
42 const auto row_ptrs = RowPtrType(view_alloc("row_ptrs", WithoutInitializing), num_dofs + 1);
43 deep_copy(subview(row_ptrs, 0), 0UL);
44
45 const auto num_nodes = active_dofs.extent(0);
46 const auto num_constraints = row_range.extent(0);
47
49 "ComputeSystemRowEntries", RangePolicy(0, num_nodes),
51 active_dofs, node_freedom_map_table, num_nodes_per_element, node_state_indices,
52 base_active_dofs, target_active_dofs, base_node_freedom_table,
53 target_node_freedom_table, row_range, row_entries
54 }
55 );
56
58 "ComputeConstraintsRowEntries", RangePolicy(0, num_constraints),
60 num_system_dofs, base_active_dofs, target_active_dofs, row_range, row_entries
61 }
62 );
63
65 "ScanRowEntries", RangePolicy(0, num_dofs),
66 ScanRowEntries<RowPtrType>{row_entries, row_ptrs}
67 );
68
69 return row_ptrs;
70 }
71};
72} // namespace kynema::solver
Definition calculate_error_sum_squares.hpp:5
Top level function object for calculating the row pointers of the CRS matrix to be solved during each...
Definition compute_row_ptrs.hpp:16
static RowPtrType invoke(size_t num_system_dofs, size_t num_dofs, const ConstView< size_t * > &active_dofs, const ConstView< size_t * > &node_freedom_map_table, const ConstView< size_t * > &num_nodes_per_element, const ConstView< size_t ** > &node_state_indices, const ConstView< size_t * > &base_active_dofs, const ConstView< size_t * > &target_active_dofs, const ConstView< size_t *[6]> &base_node_freedom_table, const ConstView< size_t *[6]> &target_node_freedom_table, const ConstView< Kokkos::pair< size_t, size_t > * > &row_range)
Definition compute_row_ptrs.hpp:23
Kokkos::View< ValueType, DeviceType > View
Definition compute_row_ptrs.hpp:19
typename RowPtrType::device_type DeviceType
Definition compute_row_ptrs.hpp:17
typename View< ValueType >::const_type ConstView
Definition compute_row_ptrs.hpp:21