Multiscale Universal Interface  2.0
A Concurrent Framework for Coupling Heterogeneous Solvers
preconditioner.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Multiscale Universal Interface Code Coupling Library *
3 * *
4 * Copyright (C) 2023 W. Liu *
5 * *
6 * This software is jointly licensed under the Apache License, Version 2.0 *
7 * and the GNU General Public License version 3, you may use it according *
8 * to either. *
9 * *
10 * ** Apache License, version 2.0 ** *
11 * *
12 * Licensed under the Apache License, Version 2.0 (the "License"); *
13 * you may not use this file except in compliance with the License. *
14 * You may obtain a copy of the License at *
15 * *
16 * http://www.apache.org/licenses/LICENSE-2.0 *
17 * *
18 * Unless required by applicable law or agreed to in writing, software *
19 * distributed under the License is distributed on an "AS IS" BASIS, *
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
21 * See the License for the specific language governing permissions and *
22 * limitations under the License. *
23 * *
24 * ** GNU General Public License, version 3 ** *
25 * *
26 * This program is free software: you can redistribute it and/or modify *
27 * it under the terms of the GNU General Public License as published by *
28 * the Free Software Foundation, either version 3 of the License, or *
29 * (at your option) any later version. *
30 * *
31 * This program is distributed in the hope that it will be useful, *
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
34 * GNU General Public License for more details. *
35 * *
36 * You should have received a copy of the GNU General Public License *
37 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
38 *****************************************************************************/
39 
47 #ifndef MUI_PRECONDITIONER_H_
48 #define MUI_PRECONDITIONER_H_
49 
50 namespace mui {
51 namespace linalg {
52 
53 // Base preconditioner class
54 template<typename ITYPE, typename VTYPE>
56 
57  public:
58  // Abstract function on preconditioner apply
60  // Destructor
61  virtual ~preconditioner(){};
62 };
63 
64 // Class of Incomplete LU preconditioner
65 template<typename ITYPE, typename VTYPE>
66 class incomplete_lu_preconditioner : public preconditioner<ITYPE,VTYPE> {
67 
68  public:
69  // Constructor
71  // Destructor
73  // Member function on preconditioner apply
75 
76  private:
77  // Lower triangular matrix for Incomplete LU preconditioner
79  // Upper triangular matrix for Incomplete LU preconditioner
81 
82 };
83 
84 // Class of Incomplete Cholesky preconditioner
85 template<typename ITYPE, typename VTYPE>
87 
88  public:
89  // Constructor
91  // Destructor
93  // Member function on preconditioner apply
95 
96  private:
97  // Lower triangular matrix for Incomplete Cholesky preconditioner
99 };
100 
101 // Class of Symmetric Successive Over-relaxation preconditioner
102 template<typename ITYPE, typename VTYPE>
104 
105  public:
106  // Constructor
108  // Destructor
110  // Member function on preconditioner apply
112 
113  private:
114  // The coefficient matrix of the matrix equation
116  // The relaxation parameter
117  VTYPE omega_;
118 };
119 
120 // Class of diagonal (Jacobi) preconditioner
121 template<typename ITYPE, typename VTYPE>
122 class diagonal_preconditioner : public preconditioner<ITYPE,VTYPE> {
123 
124  public:
125  // Constructor
127  // Destructor
129  // Member function on preconditioner apply
131 
132  private:
133  // The inverse diagonal matrix
134  sparse_matrix<ITYPE,VTYPE> inv_diag_;
135 
136 };
137 
138 } // linalg
139 } // mui
140 
141 // Include implementations
142 #include "../linear_algebra/preconditioner_ilu.h"
143 #include "../linear_algebra/preconditioner_ic.h"
144 #include "../linear_algebra/preconditioner_ssor.h"
145 #include "../linear_algebra/preconditioner_diagonal.h"
146 
147 #endif /* MUI_PRECONDITIONER_H_ */
Definition: preconditioner.h:122
diagonal_preconditioner(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_diagonal.h:58
~diagonal_preconditioner()
Definition: preconditioner_diagonal.h:73
sparse_matrix< ITYPE, VTYPE > apply(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_diagonal.h:80
~incomplete_cholesky_preconditioner()
Definition: preconditioner_ic.h:85
incomplete_cholesky_preconditioner(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_ic.h:58
sparse_matrix< ITYPE, VTYPE > apply(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_ic.h:92
Definition: preconditioner.h:66
incomplete_lu_preconditioner(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_ilu.h:55
sparse_matrix< ITYPE, VTYPE > apply(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_ilu.h:110
~incomplete_lu_preconditioner()
Definition: preconditioner_ilu.h:102
Definition: preconditioner.h:55
virtual ~preconditioner()
Definition: preconditioner.h:61
virtual sparse_matrix< ITYPE, VTYPE > apply(const sparse_matrix< ITYPE, VTYPE > &)=0
Definition: matrix.h:61
sparse_matrix< ITYPE, VTYPE > apply(const sparse_matrix< ITYPE, VTYPE > &)
Definition: preconditioner_ssor.h:72
~symmetric_successive_over_relaxation_preconditioner()
Definition: preconditioner_ssor.h:63
symmetric_successive_over_relaxation_preconditioner(const sparse_matrix< ITYPE, VTYPE > &, VTYPE=1.0)
Definition: preconditioner_ssor.h:58
Definition: comm.h:54