39template <
typename StorageIndex>
44 for (StorageIndex i = 0; i < transposed_connections.num_nodes(); ++i) {
45 scores[i] =
static_cast<StorageIndex
>(
46 transposed_connections.connected_nodes_to(i).size());
59template <
typename StorageIndex>
63 -> std::optional<index_type> {
64 std::optional<index_type> index;
65 auto score = std::numeric_limits<StorageIndex>::min();
66 for (
index_type i = 0; i < scores.size(); ++i) {
68 if (scores[i] > score) {
85template <
typename StorageIndex>
104 transposed_connections.connected_nodes_to(*selection)) {
107 for (
const auto k : connections.connected_nodes_to(j)) {
112 for (
const auto j : connections.connected_nodes_to(*selection)) {
119 return classification;
Class of lists of connected nodes per node.
Class of vectors wrapping std::vector class to use singed integers as indices.
Definition of index_type type.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of internal implementations of algebraic multigrid method ruge1987.
auto find_max_score_index(const util::vector< StorageIndex > &scores, const util::vector< node_layer > &classification) -> std::optional< index_type >
Find the index of the maximum score among unclassified nodes.
auto compute_node_scores(const node_connection_list< StorageIndex > &transposed_connections) -> util::vector< StorageIndex >
Compute the first scores of nodes.
auto build_first_coarse_grid_candidate(const node_connection_list< StorageIndex > &connections, const node_connection_list< StorageIndex > &transposed_connections) -> util::vector< node_layer >
Build the first candidate of a coarse grid.
@ unclassified
Unclassified.
@ fine
Only in finer grid.
Definition of node_connection_list class.
Definition of node_class enumeration.
Definition of vector class.