LUscalarMatrix.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) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::LUscalarMatrix
28
29Description
30 Class to perform the LU decomposition on a symmetric matrix.
31
32SourceFiles
33 LUscalarMatrix.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef LUscalarMatrix_H
38#define LUscalarMatrix_H
39
40#include "scalarMatrices.H"
41#include "labelList.H"
42#include "FieldField.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50class lduMatrix;
51class procLduMatrix;
52
53/*---------------------------------------------------------------------------*\
54 Class LUscalarMatrix Declaration
55\*---------------------------------------------------------------------------*/
58:
60{
61 // Private data
62
63 //- Communicator to use
64 const label comm_;
65
66 //- Processor matrix offsets
67 labelList procOffsets_;
68
69 //- The pivot indices used in the LU decomposition
70 labelList pivotIndices_;
71
72
73 // Private member functions
74
75 //- Convert the given lduMatrix into this LUscalarMatrix
76 void convert
77 (
78 const lduMatrix& ldum,
79 const FieldField<Field, scalar>& interfaceCoeffs,
80 const lduInterfaceFieldPtrsList& interfaces
81 );
82
83 //- Convert the given list of procLduMatrix into this LUscalarMatrix
84 // on the master processor
85 void convert(const PtrList<procLduMatrix>& lduMatrices);
86
87
88 //- Print the ratio of the mag-sum of the off-diagonal coefficients
89 // to the mag-diagonal
90 void printDiagonalDominance() const;
91
92
93public:
94
95 // Declare name of the class and its debug switch
96 ClassName("LUscalarMatrix");
97
98
99 // Constructors
100
101 //- Construct null
103
104 //- Construct from and perform LU decomposition of the matrix M
106
107 //- Construct from lduMatrix and perform LU decomposition
109 (
110 const lduMatrix& ldum,
111 const FieldField<Field, scalar>& interfaceCoeffs,
112 const lduInterfaceFieldPtrsList& interfaces
113 );
114
115
116 // Member Functions
117
118 //- Perform the LU decomposition of the matrix M
119 void decompose(const scalarSquareMatrix& M);
120
121 //- Solve the linear system with the given source
122 // and returning the solution in the Field argument x.
123 // This function may be called with the same field for x and source.
124 template<class Type>
125 void solve(List<Type>& x, const UList<Type>& source) const;
126
127 //- Solve the linear system with the given source
128 // returning the solution
129 template<class Type>
130 tmp<Field<Type>> solve(const UList<Type>& source) const;
131
132 //- Set M to the inverse of this square matrix
133 void inv(scalarSquareMatrix& M) const;
134};
135
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139} // End namespace Foam
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143#ifdef NoRepository
145#endif
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149#endif
150
151// ************************************************************************* //
#define M(I)
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
Class to perform the LU decomposition on a symmetric matrix.
void decompose(const scalarSquareMatrix &M)
Perform the LU decomposition of the matrix M.
LUscalarMatrix()
Construct null.
void inv(scalarSquareMatrix &M) const
Set M to the inverse of this square matrix.
ClassName("LUscalarMatrix")
tmp< Field< Type > > solve(const UList< Type > &source) const
Solve the linear system with the given source.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
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
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition: lduMatrix.H:84
A class for managing temporary objects.
Definition: tmp.H:65
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Namespace for OpenFOAM.
CEqn solve()