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 /*
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 #pragma once
22 
23 #include <cusp/detail/config.h>
24 #include <cusp/linear_operator.h>
25 
26 namespace cusp
27 {
28 namespace precond
29 {
30 namespace aggregation
31 {
32 // forward definitions
33 template<typename MatrixType> struct sa_level;
34 } // end namespace aggregation
35 } // end namespace precond
36 
37 namespace relaxation
38 {
39 
40 template <typename ValueType, typename MemorySpace>
41 class block_jacobi : public cusp::linear_operator<ValueType, MemorySpace>
42 {
43 public:
44  ValueType default_omega;
45  cusp::array1d<ValueType,MemorySpace> diagonal;
46  cusp::array2d<ValueType,MemorySpace> temp;
47 
48  block_jacobi();
49 
50  template <typename MatrixType>
51  block_jacobi(const MatrixType& A, ValueType omega=1.0);
52 
53  template <typename MemorySpace2>
55 
56  template <typename MatrixType>
57  block_jacobi(const cusp::precond::aggregation::sa_level<MatrixType>& sa_level, ValueType weight=4.0/3.0);
58 
59  // ignores initial x
60  template<typename MatrixType, typename VectorType1, typename VectorType2>
61  void presmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
62 
63  // smooths initial x
64  template<typename MatrixType, typename VectorType1, typename VectorType2>
65  void postsmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
66 
67  template <typename MatrixType, typename VectorType1, typename VectorType2>
68  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x);
69 
70  template <typename MatrixType, typename VectorType1, typename VectorType2>
71  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x, ValueType omega);
72 };
73 
74 } // end namespace relaxation
75 } // end namespace cusp
76 
77 #include <cusp/relaxation/block_jacobi.inl>
78 
void presmooth(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
cusp::array1d< ValueType, MemorySpace > diagonal
Definition: block_jacobi.h:45
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:46