Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
cusp
precond
block_smoothed_aggregation.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2009 NVIDIA Corporation
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
*/
16
21
22
#pragma once
23
24
#include <cusp/detail/config.h>
25
26
#include <vector>
// TODO replace with host_vector
27
#include <cusp/linear_operator.h>
28
29
#include <cusp/coo_matrix.h>
30
#include <cusp/csr_matrix.h>
31
#include <cusp/hyb_matrix.h>
32
#include <
cusp/block_multilevel.h
>
33
#include <
cusp/relaxation/block_jacobi.h
>
34
#include <
cusp/relaxation/block_polynomial.h
>
35
36
#include <cusp/detail/spectral_radius.h>
37
#include <
cusp/detail/block_lu.h
>
38
39
namespace
cusp
40
{
41
namespace
precond
42
{
43
namespace
aggregation
44
{
45
50
51
template
<
typename
IndexType,
typename
ValueType,
typename
MemorySpace>
52
struct
amg_container
{};
53
54
template
<
typename
IndexType,
typename
ValueType>
55
struct
amg_container
<IndexType,ValueType,
cusp
::host_memory>
56
{
57
// use CSR on host
58
typedef
typename
cusp::csr_matrix<IndexType,ValueType,cusp::host_memory>
setup_type
;
59
typedef
typename
cusp::csr_matrix<IndexType,ValueType,cusp::host_memory>
solve_type
;
60
};
61
62
template
<
typename
IndexType,
typename
ValueType>
63
struct
amg_container
<IndexType,ValueType,
cusp
::device_memory>
64
{
65
// use COO on device
66
// typedef typename cusp::coo_matrix<IndexType,ValueType,cusp::device_memory> setup_type;
67
// typedef typename cusp::hyb_matrix<IndexType,ValueType,cusp::device_memory> solve_type;
68
typedef
typename
cusp::csr_matrix<IndexType,ValueType,cusp::device_memory>
setup_type
;
69
typedef
typename
cusp::csr_matrix<IndexType,ValueType,cusp::device_memory>
solve_type
;
70
71
};
72
73
template
<
typename
MatrixType>
74
struct
sa_level
75
{
76
typedef
typename
MatrixType::index_type
IndexType
;
77
typedef
typename
MatrixType::value_type
ValueType
;
78
typedef
typename
MatrixType::memory_space
MemorySpace
;
79
80
MatrixType
A_
;
// matrix
81
cusp::array1d<IndexType,MemorySpace>
aggregates
;
// aggregates
82
cusp::array1d<ValueType,MemorySpace>
B
;
// near-nullspace candidates
83
84
ValueType
rho_DinvA
;
85
86
sa_level
() {}
87
88
template
<
typename
SA_Level_Type>
89
sa_level
(
const
SA_Level_Type&
sa_level
) :
A_
(
sa_level
.
A_
),
aggregates
(
sa_level
.
aggregates
),
B
(
sa_level
.
B
),
rho_DinvA
(
sa_level
.
rho_DinvA
) {}
90
};
91
92
97
//typename SmootherType = cusp::relaxation::block_polynomial<ValueType,MemorySpace>
98
template
<
typename
IndexType,
typename
ValueType,
typename
MemorySpace,
99
typename
SmootherType,
100
typename
SolverType =
cusp::detail::block_lu_solver<ValueType,cusp::host_memory>
>
101
class
block_smoothed_aggregation
:
public
cusp::block_multilevel
< typename amg_container<IndexType,ValueType,MemorySpace>::solve_type, SmootherType, SolverType>
102
{
103
104
typedef
typename
amg_container<IndexType,ValueType,MemorySpace>::setup_type
SetupMatrixType
;
105
typedef
typename
amg_container<IndexType,ValueType,MemorySpace>::solve_type
SolveMatrixType
;
106
typedef
typename
cusp::block_multilevel<SolveMatrixType,SmootherType,SolverType>
Parent
;
107
108
public
:
109
110
ValueType
theta
;
111
IndexType
numRHS
;
112
std::vector< sa_level<SetupMatrixType> >
sa_levels
;
113
114
template
<
typename
MatrixType>
115
block_smoothed_aggregation
(
const
MatrixType& A,
const
IndexType
numRHS
,
const
ValueType
theta
=0);
116
117
template
<
typename
MatrixType,
typename
ArrayType>
118
block_smoothed_aggregation
(
const
MatrixType& A,
const
ArrayType& B,
const
IndexType
numRHS
,
const
ValueType
theta
=0);
119
120
template
<
typename
MemorySpace2,
typename
SmootherType2,
typename
SolverType2>
121
block_smoothed_aggregation
(
const
block_smoothed_aggregation<IndexType,ValueType,MemorySpace2,SmootherType2,SolverType2>
& M);
122
123
protected
:
124
125
template
<
typename
MatrixType,
typename
ArrayType>
126
void
init
(
const
MatrixType& A,
const
ArrayType& B);
127
128
void
extend_hierarchy
(
void
);
129
};
130
132
133
}
// end namespace aggregation
134
}
// end namespace precond
135
}
// end namespace cusp
136
137
#include <cusp/precond/block_smoothed_aggregation.inl>
block_jacobi.h
block_lu.h
block_multilevel.h
block_polynomial.h
cusp::block_multilevel
Definition
block_multilevel.h:37
cusp::block_multilevel::IndexType
MatrixType::index_type IndexType
Definition
block_multilevel.h:40
cusp::block_multilevel::ValueType
MatrixType::value_type ValueType
Definition
block_multilevel.h:41
cusp::detail::block_lu_solver
Definition
block_lu.h:125
cusp::precond::aggregation::block_smoothed_aggregation::block_smoothed_aggregation
block_smoothed_aggregation(const block_smoothed_aggregation< IndexType, ValueType, MemorySpace2, SmootherType2, SolverType2 > &M)
cusp::precond::aggregation::block_smoothed_aggregation::block_smoothed_aggregation
block_smoothed_aggregation(const MatrixType &A, const ArrayType &B, const IndexType numRHS, const ValueType theta=0)
cusp::precond::aggregation::block_smoothed_aggregation::init
void init(const MatrixType &A, const ArrayType &B)
cusp::precond::aggregation::block_smoothed_aggregation::SetupMatrixType
amg_container< IndexType, ValueType, MemorySpace >::setup_type SetupMatrixType
Definition
block_smoothed_aggregation.h:104
cusp::precond::aggregation::block_smoothed_aggregation::SolveMatrixType
amg_container< IndexType, ValueType, MemorySpace >::solve_type SolveMatrixType
Definition
block_smoothed_aggregation.h:105
cusp::precond::aggregation::block_smoothed_aggregation::block_smoothed_aggregation
block_smoothed_aggregation(const MatrixType &A, const IndexType numRHS, const ValueType theta=0)
cusp::precond::aggregation::block_smoothed_aggregation::Parent
cusp::block_multilevel< SolveMatrixType, SmootherType, SolverType > Parent
Definition
block_smoothed_aggregation.h:106
cusp::precond::aggregation::block_smoothed_aggregation::sa_levels
std::vector< sa_level< SetupMatrixType > > sa_levels
Definition
block_smoothed_aggregation.h:112
cusp::precond::aggregation::block_smoothed_aggregation::extend_hierarchy
void extend_hierarchy(void)
cusp::precond::aggregation::block_smoothed_aggregation::numRHS
IndexType numRHS
Definition
block_smoothed_aggregation.h:111
cusp::precond::aggregation::block_smoothed_aggregation::theta
ValueType theta
Definition
block_smoothed_aggregation.h:110
cusp::precond::aggregation
Definition
block_smoothed_aggregation.h:44
cusp::precond
Definition
block_smoothed_aggregation.h:42
cusp
Definition
block_monitor.h:38
cusp::precond::aggregation::amg_container< IndexType, ValueType, cusp::device_memory >::solve_type
cusp::csr_matrix< IndexType, ValueType, cusp::device_memory > solve_type
Definition
block_smoothed_aggregation.h:69
cusp::precond::aggregation::amg_container< IndexType, ValueType, cusp::device_memory >::setup_type
cusp::csr_matrix< IndexType, ValueType, cusp::device_memory > setup_type
Definition
block_smoothed_aggregation.h:68
cusp::precond::aggregation::amg_container< IndexType, ValueType, cusp::host_memory >::setup_type
cusp::csr_matrix< IndexType, ValueType, cusp::host_memory > setup_type
Definition
block_smoothed_aggregation.h:58
cusp::precond::aggregation::amg_container< IndexType, ValueType, cusp::host_memory >::solve_type
cusp::csr_matrix< IndexType, ValueType, cusp::host_memory > solve_type
Definition
block_smoothed_aggregation.h:59
cusp::precond::aggregation::amg_container
Definition
block_smoothed_aggregation.h:52
cusp::precond::aggregation::sa_level::B
cusp::array1d< ValueType, MemorySpace > B
Definition
block_smoothed_aggregation.h:82
cusp::precond::aggregation::sa_level::IndexType
MatrixType::index_type IndexType
Definition
block_smoothed_aggregation.h:76
cusp::precond::aggregation::sa_level::ValueType
MatrixType::value_type ValueType
Definition
block_smoothed_aggregation.h:77
cusp::precond::aggregation::sa_level::MemorySpace
MatrixType::memory_space MemorySpace
Definition
block_smoothed_aggregation.h:78
cusp::precond::aggregation::sa_level::sa_level
sa_level(const SA_Level_Type &sa_level)
Definition
block_smoothed_aggregation.h:89
cusp::precond::aggregation::sa_level::sa_level
sa_level()
Definition
block_smoothed_aggregation.h:86
cusp::precond::aggregation::sa_level::aggregates
cusp::array1d< IndexType, MemorySpace > aggregates
Definition
block_smoothed_aggregation.h:81
cusp::precond::aggregation::sa_level::A_
MatrixType A_
Definition
block_smoothed_aggregation.h:80
cusp::precond::aggregation::sa_level::rho_DinvA
ValueType rho_DinvA
Definition
block_smoothed_aggregation.h:84
Generated by
1.17.0