DiagonalMatrix.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  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::DiagonalMatrix
29 
30 Description
31  A 2D diagonal matrix of objects of type <Type>, size (N x N)
32 
33 SourceFiles
34  DiagonalMatrix.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef DiagonalMatrix_H
39 #define DiagonalMatrix_H
40 
41 #include "List.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward Declarations
49 template<class Form, class Type> class Matrix;
50 
51 /*---------------------------------------------------------------------------*\
52  Class DiagonalMatrix Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
56 class DiagonalMatrix
57 :
58  public List<Type>
59 {
60 public:
61 
62  // Constructors
63 
64  //- Construct null.
66 
67  //- Construct empty from size
68  explicit DiagonalMatrix<Type>(const label n);
69 
70  //- Construct from size
71  //- initializing all elements to the given value
72  DiagonalMatrix<Type>(const label n, const zero);
73 
74  //- Construct from size and a value
75  DiagonalMatrix<Type>(const label n, const Type& val);
76 
77  //- Construct from the diagonal of a Matrix
78  template<class Form>
80 
81 
82  // Member Functions
83 
84  //- Invert the diagonal matrix and return itself
86 
87 };
88 
89 
90 // Global functions
91 
92 //- Return the diagonal Matrix inverse
93 template<class Type>
95 
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 } // End namespace Foam
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 #ifdef NoRepository
104  #include "DiagonalMatrix.C"
105 #endif
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 #endif
110 
111 // ************************************************************************* //
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
List.H
Foam::DiagonalMatrix::invert
DiagonalMatrix< Type > & invert()
Invert the diagonal matrix and return itself.
Definition: DiagonalMatrix.C:78
DiagonalMatrix.C
Foam::Matrix
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
Definition: DiagonalMatrix.H:48
Foam::DiagonalMatrix
A 2D diagonal matrix of objects of type <Type>, size (N x N)
Definition: DiagonalMatrix.H:55
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61