Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
block_multilevel.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 
31 #pragma once
32 
33 #include <cusp/detail/config.h>
34 #include <cusp/detail/lu.h>
35 #include <cusp/array2d.h>
36 #include <cusp/array1d.h>
37 #include <cusp/linear_operator.h>
38 
39 namespace cusp
40 {
41 
42 template <typename MatrixType, typename SmootherType, typename SolverType>
44  public cusp::linear_operator<typename MatrixType::value_type,
45  typename MatrixType::memory_space>
46 {
47 public:
48 
49  typedef typename MatrixType::index_type IndexType;
51  typedef typename MatrixType::memory_space MemorySpace;
52  typedef typename SmootherType::orientation Orientation;
53 
54  struct level
55  {
56  MatrixType R; // restriction operator
57  MatrixType A; // matrix
58  MatrixType P; // prolongation operator
59  cusp::array2d<ValueType,MemorySpace,Orientation> x; // per-level solution
60  cusp::array2d<ValueType,MemorySpace,Orientation> b; // per-level rhs
61  cusp::array2d<ValueType,MemorySpace,Orientation> residual; // per-level residual
62 
63  SmootherType smoother;
64 
65  level(){}
66 
67  template<typename Level_Type>
68  level(const Level_Type& level) : R(level.R), A(level.A), P(level.P), x(level.x), b(level.b), residual(level.residual), smoother(level.smoother){}
69  };
70 
71  SolverType solver;
72 
73  std::vector<level> levels;
74 
76 
77  template <typename MatrixType2, typename SmootherType2, typename SolverType2>
79 
80  template <typename Array1, typename Array2>
81  void operator()(const Array1& x, Array2& y);
82 
83  template <typename Array1, typename Array2>
84  void solve(const Array1& b, Array2& x);
85 
86  template <typename Array1, typename Array2, typename Monitor>
87  void solve(const Array1& b, Array2& x, Monitor& monitor);
88 
89  void print( void );
90 
91  double operator_complexity( void );
92 
93  double grid_complexity( void );
94 
95 protected:
96 
97  template <typename Array1, typename Array2>
98  void _solve(const Array1& b, Array2& x, const size_t i);
99 };
103 } // end namespace cusp
104 
105 #include <cusp/block_multilevel.inl>
void operator()(const Array1 &x, Array2 &y)
std::vector< level > levels
void _solve(const Array1 &b, Array2 &x, const size_t i)
cusp::array2d< ValueType, MemorySpace, Orientation > b
level(const Level_Type &level)
void solve(const Array1 &b, Array2 &x)
MatrixType::index_type IndexType
double operator_complexity(void)
MatrixType::value_type ValueType
MatrixType::memory_space MemorySpace
cusp::array2d< ValueType, MemorySpace, Orientation > residual
cusp::array2d< ValueType, MemorySpace, Orientation > x
double grid_complexity(void)
SmootherType::orientation Orientation