Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
block_jacobi.h
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 /*
11  * Copyright 2008-2009 NVIDIA Corporation
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
30 #pragma once
31 
32 #include <cusp/detail/config.h>
33 #include <cusp/linear_operator.h>
34 
35 namespace cusp
36 {
37 namespace precond
38 {
39 namespace aggregation
40 {
41 // forward definitions
42 template<typename MatrixType> struct sa_level;
43 } // end namespace aggregation
44 } // end namespace precond
45 
46 namespace relaxation
47 {
48 
49 template <typename ValueType, typename MemorySpace>
50 class block_jacobi : public cusp::linear_operator<ValueType, MemorySpace>
51 {
52 public:
53  ValueType default_omega;
54  cusp::array1d<ValueType,MemorySpace> diagonal;
55  cusp::array2d<ValueType,MemorySpace> temp;
56 
57  block_jacobi();
58 
59  template <typename MatrixType>
60  block_jacobi(const MatrixType& A, ValueType omega=1.0);
61 
62  template <typename MemorySpace2>
64 
65  template <typename MatrixType>
66  block_jacobi(const cusp::precond::aggregation::sa_level<MatrixType>& sa_level, ValueType weight=4.0/3.0);
67 
68  // ignores initial x
69  template<typename MatrixType, typename VectorType1, typename VectorType2>
70  void presmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
71 
72  // smooths initial x
73  template<typename MatrixType, typename VectorType1, typename VectorType2>
74  void postsmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
75 
76  template <typename MatrixType, typename VectorType1, typename VectorType2>
77  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x);
78 
79  template <typename MatrixType, typename VectorType1, typename VectorType2>
80  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x, ValueType omega);
81 };
82 
83 } // end namespace relaxation
84 } // end namespace cusp
85 
86 #include <cusp/relaxation/block_jacobi.inl>
void presmooth(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
cusp::array1d< ValueType, MemorySpace > diagonal
Definition: block_jacobi.h:54
void postsmooth(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
void operator()(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
cusp::array2d< ValueType, MemorySpace > temp
Definition: block_jacobi.h:55