numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
create_coarse_grid.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
28
30
41template <base::concepts::sparse_matrix Matrix>
42[[nodiscard]] inline auto create_coarse_grid(
43 const Matrix& matrix, typename Matrix::Scalar strong_coeff_rate_threshold)
45 const auto connections =
46 compute_strong_connection_list(matrix, strong_coeff_rate_threshold);
47 const auto transposed_connections = connections.transpose();
48 auto node_classification =
49 build_first_coarse_grid_candidate(connections, transposed_connections);
51 connections, transposed_connections, node_classification);
52 return node_classification;
53}
54
55} // namespace num_collect::linear::impl::amg
Definition of build_first_coarse_grid_candidate function.
Class of vectors wrapping std::vector class to use singed integers as indices.
Definition vector.h:37
Definition of compute_strong_connection_list function.
Namespace of internal implementations of algebraic multigrid method ruge1987.
void tune_coarse_grid_selection(const node_connection_list< StorageIndex > &connections, const node_connection_list< StorageIndex > &transposed_connections, util::vector< node_layer > &node_classification)
Tune a coarse grid to satisfy the condition for interpolation specified in ruge1987.
auto create_coarse_grid(const Matrix &matrix, typename Matrix::Scalar strong_coeff_rate_threshold) -> util::vector< node_layer >
Create a coarse grid from a sparse matrix using an algorithm in ruge1987.
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.
auto compute_strong_connection_list(const Matrix &matrix, typename Matrix::Scalar strong_coeff_rate_threshold) -> node_connection_list< typename Matrix::StorageIndex >
Compute a list of strong connections in a matrix ruge1987.
Definition of node_class enumeration.
Definition of sparse_matrix concept.
Definition of tune_coarse_grid_selection function.
Definition of vector class.