SymmetricSquareMatrix.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-2020 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::SymmetricSquareMatrix
29 
30 Description
31  A templated (N x N) square matrix of objects of <Type>,
32  containing N*N elements, derived from Matrix.
33 
34 See also
35  Test-SymmetricSquareMatrix.C
36 
37 SourceFiles
38  SymmetricSquareMatrixI.H
39  SymmetricSquareMatrix.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef SymmetricSquareMatrix_H
44 #define SymmetricSquareMatrix_H
45 
46 #include "SquareMatrix.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class SymmetricSquareMatrix Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public Matrix<SymmetricSquareMatrix<Type>, Type>
61 {
62 
63 public:
64 
65  // Generated Methods
66 
67  //- Default construct
68  SymmetricSquareMatrix() = default;
69 
70  //- Copy construct
72 
73  //- Copy assignment
75 
76 
77  // Constructors
78 
79  //- Construct for given size (rows == cols)
80  inline explicit SymmetricSquareMatrix(const label n);
81 
82  //- Construct for given size (rows == cols)
83  //- initializing all elements to zero
84  inline SymmetricSquareMatrix(const label n, const Foam::zero);
85 
86  //- Construct for given size (rows == cols)
87  //- initializing all elements to the given value
88  inline SymmetricSquareMatrix(const label n, const Type& val);
89 
90  //- Construct for given size (rows == cols)
91  //- initializing to the identity matrix
92  template<class AnyType>
93  inline SymmetricSquareMatrix(const label n, const Identity<AnyType>);
94 
95  //- Construct from Istream
96  inline explicit SymmetricSquareMatrix(Istream& is);
97 
98  //- Clone
100 
101 
102  // Member Operators
103 
104  //- Assign all elements to zero
105  inline void operator=(const Foam::zero);
106 
107  //- Assign all elements to value
108  inline void operator=(const Type& val);
109 
110  //- Set to identity matrix
111  template<class AnyType>
112  void operator=(const Identity<AnyType>);
113 };
114 
115 
116 // Global Functions
117 
118 //- Return the LU decomposed SymmetricSquareMatrix inverse
119 template<class Type>
121 
122 //- Return the SymmetricSquareMatrix inverse
123 template<class Type>
125 
126 //- Return the LU decomposed SymmetricSquareMatrix det
127 template<class Type>
129 
130 //- Return the SymmetricSquareMatrix det
131 template<class Type>
132 Type det(const SymmetricSquareMatrix<Type>&);
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #include "SymmetricSquareMatrixI.H"
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #ifdef NoRepository
146  #include "SymmetricSquareMatrix.C"
147 #endif
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
Foam::detDecomposed
scalar detDecomposed(const SquareMatrix< Type > &matrix, const label sign)
Return the determinant of the LU decomposed SquareMatrix.
Definition: SquareMatrix.C:107
SymmetricSquareMatrix.C
Foam::SymmetricSquareMatrix::operator=
SymmetricSquareMatrix & operator=(const SymmetricSquareMatrix &)=default
Copy assignment.
Foam::Matrix< SymmetricSquareMatrix< Type >, Type >::n
label n() const noexcept
The number of columns.
Definition: MatrixI.H:103
Foam::Matrix
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
Definition: DiagonalMatrix.H:53
Foam::Identity
Templated identity and dual space identity tensors derived from SphericalTensor.
Definition: Identity.H:49
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::SymmetricSquareMatrix::SymmetricSquareMatrix
SymmetricSquareMatrix()=default
Default construct.
Foam::invDecomposed
SymmetricSquareMatrix< Type > invDecomposed(const SymmetricSquareMatrix< Type > &)
Return the LU decomposed SymmetricSquareMatrix inverse.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SymmetricSquareMatrix
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SymmetricSquareMatrix.H:57
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:62
SquareMatrix.H
Foam::SymmetricSquareMatrix::clone
autoPtr< SymmetricSquareMatrix< Type > > clone() const
Clone.
Definition: SymmetricSquareMatrixI.H:97
SymmetricSquareMatrixI.H
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62