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 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 2D square symmetric matrix of objects of <T>, where the
32  n x n matrix dimension is known and used for subscript bounds checking, etc.
33 
34 SourceFiles
35  SymmetricSquareMatrixI.H
36  SymmetricSquareMatrix.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef SymmetricSquareMatrix_H
41 #define SymmetricSquareMatrix_H
42 
43 #include "SquareMatrix.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class SymmetricSquareMatrix Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  public Matrix<SymmetricSquareMatrix<Type>, Type>
58 {
59 
60 public:
61 
62  // Constructors
63 
64  //- Construct null
65  inline SymmetricSquareMatrix();
66 
67  //- Construct for given size (rows == cols)
68  inline explicit SymmetricSquareMatrix(const label n);
69 
70  //- Construct for given size (rows == cols)
71  //- initializing all elements to zero
72  inline SymmetricSquareMatrix(const label n, const zero);
73 
74  //- Construct for given size (rows == cols)
75  //- initializing all elements to the given value
76  inline SymmetricSquareMatrix(const label n, const Type& val);
77 
78  //- Construct for given size (rows == cols)
79  //- setting the diagonal to one and off-diagonals to zero
80  template<class AnyType>
81  inline SymmetricSquareMatrix(const label n, const Identity<AnyType>);
82 
83  //- Construct from Istream
84  inline explicit SymmetricSquareMatrix(Istream& is);
85 
86  //- Clone
88 
89 
90  // Member Operators
91 
92  //- Assign all elements to zero
93  inline void operator=(const zero);
94 
95  //- Assign all elements to value
96  inline void operator=(const Type& val);
97 
98  //- Set to identity matrix
99  template<class AnyType>
100  void operator=(const Identity<AnyType>);
101 };
102 
103 
104 // Global Functions
105 
106 //- Return the LU decomposed SymmetricSquareMatrix inverse
107 template<class Type>
109 
110 //- Return the SymmetricSquareMatrix inverse
111 template<class Type>
113 
114 //- Return the LU decomposed SymmetricSquareMatrix det
115 template<class Type>
117 
118 //- Return the SymmetricSquareMatrix det
119 template<class Type>
120 Type det(const SymmetricSquareMatrix<Type>&);
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #include "SymmetricSquareMatrixI.H"
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #ifdef NoRepository
134  #include "SymmetricSquareMatrix.C"
135 #endif
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
SymmetricSquareMatrix.C
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
Foam::detDecomposed
scalar detDecomposed(const SquareMatrix< Type > &, const label sign)
Return the LU decomposed SquareMatrix det.
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::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::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::operator=
void operator=(const zero)
Assign all elements to zero.
Definition: SymmetricSquareMatrixI.H:113
Foam::Matrix< SymmetricSquareMatrix< Type >, Type >::n
label n() const noexcept
The number of columns.
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 2D square symmetric matrix of objects of <T>, where the n x n matrix dimension is known a...
Definition: SymmetricSquareMatrix.H:54
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SymmetricSquareMatrix::SymmetricSquareMatrix
SymmetricSquareMatrix()
Construct null.
Definition: SymmetricSquareMatrixI.H:41
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:104
SymmetricSquareMatrixI.H
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61