LLTMatrix.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::LLTMatrix
29
30Description
31 Templated class to perform the Cholesky decomposition on a
32 symmetric positive-definite matrix.
33
34 Member functions are provided to solve linear systems using the LLT
35 decomposition.
36
37SourceFiles
38 LLTMatrix.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef LLTMatrix_H
43#define LLTMatrix_H
44
45#include "SquareMatrix.H"
46#include "Field.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class LLTMatrix Declaration
55\*---------------------------------------------------------------------------*/
56
57template<class Type>
58class LLTMatrix
59:
60 public SquareMatrix<Type>
61{
62
63 // Private Member Functions
64
65 //- Solve the linear system with the given source
66 //- and return the solution in x
67 // This function may be called with the same field for x and source.
68 template<template<typename> class ListContainer>
69 void solveImpl
70 (
72 const ListContainer<Type>& source
73 ) const;
74
75
76public:
77
78 // Constructors
79
80 //- Construct null
81 LLTMatrix();
82
83 //- Construct and perform the decomposition on input square matrix
84 LLTMatrix(const SquareMatrix<Type>& mat);
85
86
87 // Member Functions
88
89 //- Copy matrix and perform Cholesky decomposition
90 void decompose(const SquareMatrix<Type>& mat);
91
92 //- Solve the linear system with the given source
93 //- and return the solution in the argument x.
94 // This function may be called with the same field for x and source.
95 void solve
96 (
98 const UList<Type>& source
99 ) const;
100
101 //- Solve the linear system with the given source
102 //- and return the solution in the argument x.
103 // This function may be called with the same field for x and source.
104 template<class Addr>
105 void solve
106 (
107 List<Type>& x,
108 const IndirectListBase<Type, Addr>& source
109 ) const;
110
111 //- Solve the linear system with the given source
112 //- return the solution
114 (
115 const UList<Type>& source
116 ) const;
117
118 //- Solve the linear system with the given source
119 //- return the solution
120 template<class Addr>
122 (
123 const IndirectListBase<Type, Addr>& source
124 ) const;
125};
126
127
128// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130} // End namespace Foam
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134#ifdef NoRepository
135 #include "LLTMatrix.C"
136#endif
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
Templated class to perform the Cholesky decomposition on a symmetric positive-definite matrix.
Definition: LLTMatrix.H:60
tmp< Field< Type > > solve(const IndirectListBase< Type, Addr > &source) const
void decompose(const SquareMatrix< Type > &mat)
Copy matrix and perform Cholesky decomposition.
Definition: LLTMatrix.C:48
LLTMatrix()
Construct null.
Definition: LLTMatrix.C:34
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SquareMatrix.H:66
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
CEqn solve()